2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
#pragma once
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-26 09:52:15 +00:00
|
|
|
// kwin
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "options.h"
|
|
|
|
#include "rules.h"
|
2015-03-05 09:21:03 +00:00
|
|
|
#include "abstract_client.h"
|
2013-02-04 10:20:15 +00:00
|
|
|
#include "xcbutils.h"
|
2013-04-26 09:52:15 +00:00
|
|
|
// Qt
|
2014-11-28 13:50:21 +00:00
|
|
|
#include <QElapsedTimer>
|
2014-12-02 12:50:26 +00:00
|
|
|
#include <QFlags>
|
|
|
|
#include <QPointer>
|
2013-04-26 09:52:15 +00:00
|
|
|
#include <QPixmap>
|
2013-10-08 06:33:23 +00:00
|
|
|
#include <QWindow>
|
2013-04-26 09:52:15 +00:00
|
|
|
// X
|
2013-07-31 08:11:39 +00:00
|
|
|
#include <xcb/sync.h>
|
2007-06-25 08:51:44 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
// TODO: Cleanup the order of things in this .h file
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
class QTimer;
|
|
|
|
class KStartupInfoData;
|
2013-04-26 09:52:15 +00:00
|
|
|
class KStartupInfoId;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2014-03-20 08:19:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Defines Predicates on how to search for a Client.
|
|
|
|
*
|
|
|
|
* Used by Workspace::findClient.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-03-20 08:19:53 +00:00
|
|
|
enum class Predicate {
|
|
|
|
WindowMatch,
|
|
|
|
WrapperIdMatch,
|
|
|
|
FrameIdMatch,
|
|
|
|
InputIdMatch
|
|
|
|
};
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
class KWIN_EXPORT X11Client : public AbstractClient
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* By how much the window wishes to grow/shrink at least. Usually QSize(1,1).
|
|
|
|
* MAY BE DISOBEYED BY THE WM! It's only for information, do NOT rely on it at all.
|
|
|
|
* The value is evaluated each time the getter is called.
|
|
|
|
* Because of that no changed signal is provided.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(QSize basicUnit READ basicUnit)
|
2012-03-31 17:09:00 +00:00
|
|
|
/**
|
|
|
|
* A client can block compositing. That is while the Client is alive and the state is set,
|
|
|
|
* Compositing is suspended and is resumed when there are no Clients blocking compositing any
|
|
|
|
* more.
|
|
|
|
*
|
|
|
|
* This is actually set by a window property, unfortunately not used by the target application
|
|
|
|
* group. For convenience it's exported as a property to the scripts.
|
|
|
|
*
|
|
|
|
* Use with care!
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-03-31 17:09:00 +00:00
|
|
|
Q_PROPERTY(bool blocksCompositing READ isBlockingCompositing WRITE setBlockingCompositing NOTIFY blockingCompositingChanged)
|
2014-07-01 13:44:02 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client uses client side window decorations.
|
|
|
|
* Only GTK+ are detected.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-07-01 13:44:02 +00:00
|
|
|
Q_PROPERTY(bool clientSideDecorated READ isClientSideDecorated NOTIFY clientSideDecoratedChanged)
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2019-09-24 08:48:08 +00:00
|
|
|
explicit X11Client();
|
2020-04-27 18:44:12 +00:00
|
|
|
~X11Client() override; ///< Use destroyClient() or releaseWindow()
|
|
|
|
|
2013-05-02 16:26:05 +00:00
|
|
|
xcb_window_t wrapperId() const;
|
2013-02-04 10:20:15 +00:00
|
|
|
xcb_window_t inputId() const { return m_decoInputExtent; }
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
xcb_window_t frameId() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2020-02-13 16:40:53 +00:00
|
|
|
QRect inputGeometry() const override;
|
2019-10-03 19:43:28 +00:00
|
|
|
QRect bufferGeometry() const override;
|
2019-12-02 17:36:13 +00:00
|
|
|
QMargins bufferMargins() const override;
|
2019-10-03 19:43:28 +00:00
|
|
|
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
QPoint framePosToClientPos(const QPoint &point) const override;
|
|
|
|
QPoint clientPosToFramePos(const QPoint &point) const override;
|
|
|
|
QSize frameSizeToClientSize(const QSize &size) const override;
|
|
|
|
QSize clientSizeToFrameSize(const QSize &size) const override;
|
[x11] Fix visual artifacts during interactive resize
Summary:
When a window is being interactively resized, its contents may jump. The
reason why that happens is because KWin renders partially resized client
window. Composite extension spec says that a window will get a new pixmap
each time it is resized or mapped. This applies to the frame window, but
not to the client window itself. If the client window is resized,
off-screen storage for the frame window won't be reallocated. Therefore,
KWin may render partially resized client window if the client doesn't
attempt to be in sync with our rendering loop. Currently, the only way
to do that is to use extended frame counters, which are not supported by
KWin.
So, in order to fix visual artifacts during interactive resize, we need
somehow forcefully re-allocate off-screen storage for the frame window.
Unfortunately, Composite extension doesn't provide any request to do
that, so the only option we have is to resize the frame window.
BUG: 415839
FIXED-IN: 5.18.0
Reviewers: #kwin
Subscribers: davidedmundson, ngraham, alexde, fredrik, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D26914
2020-02-03 11:29:43 +00:00
|
|
|
QRect frameRectToBufferRect(const QRect &rect) const;
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
|
2020-02-13 16:40:53 +00:00
|
|
|
QMatrix4x4 inputTransformation() const override;
|
|
|
|
|
2015-03-05 12:35:54 +00:00
|
|
|
bool isTransient() const override;
|
2018-12-31 17:57:13 +00:00
|
|
|
bool groupTransient() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool wasOriginallyGroupTransient() const;
|
2015-09-11 13:55:23 +00:00
|
|
|
QList<AbstractClient*> mainClients() const override; // Call once before loop , is not indirect
|
2015-09-11 12:14:21 +00:00
|
|
|
bool hasTransient(const AbstractClient* c, bool indirect) const override;
|
2013-05-03 06:53:35 +00:00
|
|
|
void checkTransient(xcb_window_t w);
|
2015-03-05 12:59:18 +00:00
|
|
|
AbstractClient* findModal(bool allow_itself = false) override;
|
2018-12-31 17:57:13 +00:00
|
|
|
const Group* group() const override;
|
|
|
|
Group* group() override;
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
void checkGroup(Group* gr = nullptr, bool force = false);
|
2011-01-30 14:34:42 +00:00
|
|
|
void changeClientLeaderGroup(Group* gr);
|
2015-03-12 14:35:36 +00:00
|
|
|
void updateWindowRules(Rules::Types selection) override;
|
2020-01-16 13:58:49 +00:00
|
|
|
void applyWindowRules() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateFullscreenMonitors(NETFullscreenMonitors topology);
|
|
|
|
|
|
|
|
bool hasNETSupport() const;
|
|
|
|
|
2015-05-27 11:21:56 +00:00
|
|
|
QSize minSize() const override;
|
|
|
|
QSize maxSize() const override;
|
2011-11-02 22:05:03 +00:00
|
|
|
QSize basicUnit() const;
|
2011-11-09 19:39:13 +00:00
|
|
|
QPoint inputPos() const { return input_offset; } // Inside of geometry()
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-07-26 08:32:48 +00:00
|
|
|
bool windowEvent(xcb_generic_event_t *e);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-05-03 08:20:05 +00:00
|
|
|
bool manage(xcb_window_t w, bool isMapped);
|
2011-01-30 14:34:42 +00:00
|
|
|
void releaseWindow(bool on_shutdown = false);
|
2020-02-19 15:22:23 +00:00
|
|
|
void destroyClient() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
QStringList activities() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void setOnActivity(const QString &activity, bool enable);
|
2015-03-06 10:33:51 +00:00
|
|
|
void setOnAllActivities(bool set) override;
|
2017-10-01 14:38:57 +00:00
|
|
|
void setOnActivities(QStringList newActivitiesList) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateActivities(bool includeTransients);
|
2015-03-06 10:33:51 +00:00
|
|
|
void blockActivityUpdates(bool b = true) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/// Is not minimized and not hidden. I.e. normally visible on some virtual desktop.
|
2015-03-05 09:21:03 +00:00
|
|
|
bool isShown(bool shaded_is_shown) const override;
|
2016-07-04 13:06:20 +00:00
|
|
|
bool isHiddenInternal() const override; // For compositing
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-03-06 10:33:51 +00:00
|
|
|
bool isShadeable() const override;
|
|
|
|
bool isMaximizable() const override;
|
2015-03-06 09:05:40 +00:00
|
|
|
MaximizeMode maximizeMode() const override;
|
2014-12-02 09:52:16 +00:00
|
|
|
|
2015-03-06 10:33:51 +00:00
|
|
|
bool isMinimizable() const override;
|
2015-11-05 10:30:02 +00:00
|
|
|
QRect iconGeometry() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-01-09 14:20:19 +00:00
|
|
|
bool isFullScreenable() const override;
|
2015-03-06 09:05:40 +00:00
|
|
|
void setFullScreen(bool set, bool user = true) override;
|
2015-03-05 09:21:03 +00:00
|
|
|
bool isFullScreen() const override;
|
2015-03-06 10:33:51 +00:00
|
|
|
bool userCanSetFullScreen() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect geometryFSRestore() const {
|
2019-01-10 12:16:01 +00:00
|
|
|
return geom_fs_restore; // only for session saving
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
int fullScreenMode() const {
|
2019-01-10 12:16:01 +00:00
|
|
|
return m_fullscreenMode; // only for session saving
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 11:10:40 +00:00
|
|
|
bool userNoBorder() const;
|
2015-03-06 09:05:40 +00:00
|
|
|
bool noBorder() const override;
|
|
|
|
void setNoBorder(bool set) override;
|
2015-03-06 10:33:51 +00:00
|
|
|
bool userCanSetNoBorder() const override;
|
2017-10-01 19:48:57 +00:00
|
|
|
void checkNoBorder() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
int sessionStackingOrder() const;
|
|
|
|
|
|
|
|
// Auxiliary functions, depend on the windowType
|
2015-03-06 14:04:59 +00:00
|
|
|
bool wantsInput() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-03-06 10:33:51 +00:00
|
|
|
bool isResizable() const override;
|
|
|
|
bool isMovable() const override;
|
|
|
|
bool isMovableAcrossScreens() const override;
|
2015-03-05 09:21:03 +00:00
|
|
|
bool isCloseable() const override; ///< May be closed by the user (May have a close button)
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2020-07-22 11:00:11 +00:00
|
|
|
bool takeFocus() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-12-17 14:47:36 +00:00
|
|
|
void updateDecoration(bool check_workspace_pos, bool force = false) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void updateShape();
|
|
|
|
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
using AbstractClient::move;
|
|
|
|
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) override;
|
2020-03-25 15:15:23 +00:00
|
|
|
void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
/// plainResize() simply resizes
|
2011-12-22 18:38:52 +00:00
|
|
|
void plainResize(int w, int h, ForceGeometry_t force = NormalGeometrySet);
|
|
|
|
void plainResize(const QSize& s, ForceGeometry_t force = NormalGeometrySet);
|
2011-01-30 14:34:42 +00:00
|
|
|
/// resizeWithChecks() resizes according to gravity, and checks workarea position
|
2020-03-25 15:15:23 +00:00
|
|
|
void resizeWithChecks(const QSize &size, ForceGeometry_t force = NormalGeometrySet) override;
|
2015-05-27 09:48:33 +00:00
|
|
|
void resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
|
|
|
|
void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
|
Refactor geometry constraints code
Summary:
Currently, there are a couple of issues with sizeForClientSize(). First
of all, we have a method called clientSizeToFrameSize() which does similar
thing except applying geometry constraints and checking window rules. The
other issue is that sizeForClientSize() is doing a bit too much, it checks
window rules, it applies a bunch of geometry constrains. Sometimes it
does not perform conversion between client sizes and frame sizes!
This change attempts to address those issues by replacing sizeForClientSize
with two similar methods and changing semantics of some methods of the
X11Client class.
The most significant difference between sizeForClientSize() and the new
methods is that neither constrainClientSize() nor constrainFrameSize()
check window rules. This is up to users of those methods. In many places,
we don't have to check window rules because we check isResizable(),
which returns false if the frame size is enforced by a window rule.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D26828
2020-02-12 10:38:40 +00:00
|
|
|
QSize constrainClientSize(const QSize &size, SizeMode mode = SizeModeAny) const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-12-03 16:11:14 +00:00
|
|
|
bool providesContextHelp() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QRect adjustedClientArea(const QRect& desktop, const QRect& area) const;
|
|
|
|
|
2013-05-03 09:46:18 +00:00
|
|
|
xcb_colormap_t colormap() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/// Updates visibility depending on being shaded, virtual desktop, etc.
|
|
|
|
void updateVisibility();
|
|
|
|
/// Hides a client - Basically like minimize, but without effects, it's simply hidden
|
2015-05-23 07:02:11 +00:00
|
|
|
void hideClient(bool hide) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool hiddenPreview() const; ///< Window is mapped in order to get a window pixmap
|
|
|
|
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
bool setupCompositing() override;
|
2014-04-07 14:23:17 +00:00
|
|
|
void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release) override;
|
2012-03-31 17:09:00 +00:00
|
|
|
void setBlockingCompositing(bool block);
|
2011-03-20 14:42:05 +00:00
|
|
|
inline bool isBlockingCompositing() { return blocks_compositing; }
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2017-08-20 06:56:13 +00:00
|
|
|
QString captionNormal() const override {
|
|
|
|
return cap_normal;
|
|
|
|
}
|
|
|
|
QString captionSuffix() const override {
|
|
|
|
return cap_suffix;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-10-23 13:32:10 +00:00
|
|
|
using AbstractClient::keyPressEvent;
|
|
|
|
void keyPressEvent(uint key_code, xcb_timestamp_t time); // FRAME ??
|
2015-03-05 09:21:03 +00:00
|
|
|
void updateMouseGrab() override;
|
2013-05-02 17:04:43 +00:00
|
|
|
xcb_window_t moveResizeGrabWindow() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
QPoint gravityAdjustment(xcb_gravity_t gravity) const;
|
|
|
|
const QPoint calculateGravitation(bool invert) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void NETMoveResize(int x_root, int y_root, NET::Direction direction);
|
|
|
|
void NETMoveResizeWindow(int flags, int x, int y, int width, int height);
|
2013-05-03 08:27:04 +00:00
|
|
|
void restackWindow(xcb_window_t above, int detail, NET::RequestSource source, xcb_timestamp_t timestamp,
|
2011-01-30 14:34:42 +00:00
|
|
|
bool send_event = false);
|
|
|
|
|
2013-05-03 09:35:46 +00:00
|
|
|
void gotPing(xcb_timestamp_t timestamp);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-05-03 09:29:50 +00:00
|
|
|
void updateUserTime(xcb_timestamp_t time = XCB_TIME_CURRENT_TIME);
|
2015-03-12 10:24:27 +00:00
|
|
|
xcb_timestamp_t userTime() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool hasUserTimeSupport() const;
|
|
|
|
|
|
|
|
/// Does 'delete c;'
|
2019-09-24 08:48:08 +00:00
|
|
|
static void deleteClient(X11Client *c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
static bool belongToSameApplication(const X11Client *c1, const X11Client *c2, SameApplicationChecks checks = SameApplicationChecks());
|
|
|
|
static bool sameAppWindowRoleMatch(const X11Client *c1, const X11Client *c2, bool active_hack);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2016-11-15 15:48:20 +00:00
|
|
|
void killWindow() override;
|
2015-12-03 16:11:14 +00:00
|
|
|
void showContextHelp() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void checkActiveModal();
|
|
|
|
StrutRect strutRect(StrutArea area) const;
|
|
|
|
StrutRects strutRects() const;
|
2015-06-19 22:14:15 +00:00
|
|
|
bool hasStrut() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* If shown is true the client is mapped and raised, if false
|
|
|
|
* the client is unmapped and hidden, this function is called
|
|
|
|
* when the tabbing group of the client switches its visible
|
|
|
|
* client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-05-05 10:06:24 +00:00
|
|
|
void setClientShown(bool shown) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the window has a strut that expands through the invisible area of
|
|
|
|
* an xinerama setup where the monitors are not the same resolution.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
bool hasOffscreenXineramaStrut() const;
|
|
|
|
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
QRect transparentRect() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2014-07-01 13:44:02 +00:00
|
|
|
bool isClientSideDecorated() const;
|
2014-07-24 06:55:57 +00:00
|
|
|
bool wantsShadowToBeRendered() const override;
|
2012-10-12 09:34:05 +00:00
|
|
|
|
2015-12-03 12:48:54 +00:00
|
|
|
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-01-15 15:14:28 +00:00
|
|
|
Xcb::Property fetchFirstInTabBox() const;
|
|
|
|
void readFirstInTabBox(Xcb::Property &property);
|
2011-12-01 12:15:11 +00:00
|
|
|
void updateFirstInTabBox();
|
2015-01-15 15:09:05 +00:00
|
|
|
Xcb::StringProperty fetchColorScheme() const;
|
|
|
|
void readColorScheme(Xcb::StringProperty &property);
|
2017-10-01 14:38:57 +00:00
|
|
|
void updateColorScheme() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2017-04-27 10:18:41 +00:00
|
|
|
//sets whether the client should be faked as being on all activities (and be shown during session save)
|
|
|
|
void setSessionActivityOverride(bool needed);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
bool isClient() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-02-14 14:19:35 +00:00
|
|
|
template <typename T>
|
|
|
|
void print(T &stream) const;
|
|
|
|
|
2013-08-05 07:48:14 +00:00
|
|
|
void cancelFocusOutTimer();
|
|
|
|
|
2014-02-20 11:39:23 +00:00
|
|
|
/**
|
|
|
|
* Restores the Client after it had been hidden due to show on screen edge functionality.
|
|
|
|
* In addition the property gets deleted so that the Client knows that it is visible again.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-09-15 19:03:40 +00:00
|
|
|
void showOnScreenEdge() override;
|
2014-02-20 11:39:23 +00:00
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
Xcb::StringProperty fetchApplicationMenuServiceName() const;
|
|
|
|
void readApplicationMenuServiceName(Xcb::StringProperty &property);
|
|
|
|
void checkApplicationMenuServiceName();
|
|
|
|
|
|
|
|
Xcb::StringProperty fetchApplicationMenuObjectPath() const;
|
|
|
|
void readApplicationMenuObjectPath(Xcb::StringProperty &property);
|
|
|
|
void checkApplicationMenuObjectPath();
|
|
|
|
|
2017-09-22 18:35:50 +00:00
|
|
|
struct SyncRequest {
|
|
|
|
xcb_sync_counter_t counter;
|
|
|
|
xcb_sync_int64_t value;
|
|
|
|
xcb_sync_alarm_t alarm;
|
|
|
|
xcb_timestamp_t lastTimestamp;
|
|
|
|
QTimer *timeout, *failsafeTimeout;
|
|
|
|
bool isPending;
|
|
|
|
};
|
2020-01-28 19:46:09 +00:00
|
|
|
const SyncRequest &syncRequest() const {
|
|
|
|
return m_syncRequest;
|
2017-09-22 18:35:50 +00:00
|
|
|
}
|
2020-04-27 18:44:12 +00:00
|
|
|
virtual bool wantsSyncCounter() const;
|
2017-09-22 18:35:50 +00:00
|
|
|
void handleSync();
|
|
|
|
|
2016-05-09 14:01:49 +00:00
|
|
|
static void cleanupX11();
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2015-03-05 09:21:03 +00:00
|
|
|
void closeWindow() override;
|
2017-08-03 05:11:40 +00:00
|
|
|
void updateCaption() override;
|
2012-01-03 17:32:05 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
// Handlers for X11 events
|
2013-07-26 11:46:06 +00:00
|
|
|
bool mapRequestEvent(xcb_map_request_event_t *e);
|
2013-07-26 11:34:54 +00:00
|
|
|
void unmapNotifyEvent(xcb_unmap_notify_event_t *e);
|
2013-07-26 11:40:43 +00:00
|
|
|
void destroyNotifyEvent(xcb_destroy_notify_event_t *e);
|
2013-07-26 11:56:16 +00:00
|
|
|
void configureRequestEvent(xcb_configure_request_event_t *e);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void propertyNotifyEvent(xcb_property_notify_event_t *e) override;
|
2015-01-09 10:16:57 +00:00
|
|
|
void clientMessageEvent(xcb_client_message_event_t *e) override;
|
2013-07-26 12:22:43 +00:00
|
|
|
void enterNotifyEvent(xcb_enter_notify_event_t *e);
|
2013-07-26 12:29:47 +00:00
|
|
|
void leaveNotifyEvent(xcb_leave_notify_event_t *e);
|
2013-07-26 12:35:28 +00:00
|
|
|
void focusInEvent(xcb_focus_in_event_t *e);
|
2013-07-26 12:51:56 +00:00
|
|
|
void focusOutEvent(xcb_focus_out_event_t *e);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void damageNotifyEvent() override;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-06-01 15:57:51 +00:00
|
|
|
bool buttonPressEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root, xcb_timestamp_t time = XCB_CURRENT_TIME);
|
2013-05-03 08:32:18 +00:00
|
|
|
bool buttonReleaseEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root);
|
|
|
|
bool motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x_root, int y_root);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
protected:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void debug(QDebug& stream) const override;
|
2015-02-24 09:54:28 +00:00
|
|
|
void addDamage(const QRegion &damage) override;
|
2017-11-05 09:10:17 +00:00
|
|
|
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override;
|
2015-03-12 15:08:19 +00:00
|
|
|
void doSetActive() override;
|
2015-03-13 08:36:43 +00:00
|
|
|
void doSetKeepAbove() override;
|
|
|
|
void doSetKeepBelow() override;
|
2020-05-07 16:26:24 +00:00
|
|
|
void doSetShade(ShadeMode previousShadeMode) override;
|
2020-02-03 00:19:46 +00:00
|
|
|
void doSetDesktop() override;
|
2015-03-13 13:45:21 +00:00
|
|
|
void doMinimize() override;
|
2015-06-06 19:17:23 +00:00
|
|
|
void doSetSkipPager() override;
|
2015-06-06 20:08:12 +00:00
|
|
|
void doSetSkipTaskbar() override;
|
2018-05-24 04:33:39 +00:00
|
|
|
void doSetSkipSwitcher() override;
|
2020-02-02 23:23:47 +00:00
|
|
|
void doSetDemandsAttention() override;
|
2015-09-17 09:06:59 +00:00
|
|
|
bool belongsToDesktop() const override;
|
2015-10-22 16:16:21 +00:00
|
|
|
bool doStartMoveResize() override;
|
2015-10-23 11:05:55 +00:00
|
|
|
void doPerformMoveResize() override;
|
2015-10-23 11:33:18 +00:00
|
|
|
bool isWaitingForMoveResizeSync() const override;
|
|
|
|
void doResizeSync() override;
|
2015-10-26 14:49:03 +00:00
|
|
|
QSize resizeIncrements() const override;
|
2015-12-07 15:18:30 +00:00
|
|
|
bool acceptsFocus() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2010-09-21 14:31:40 +00:00
|
|
|
//Signals for the scripting interface
|
2011-01-01 09:39:02 +00:00
|
|
|
//Signals make an excellent way for communication
|
2010-09-21 14:31:40 +00:00
|
|
|
//in between objects as compared to simple function
|
|
|
|
//calls
|
2013-07-22 14:07:39 +00:00
|
|
|
Q_SIGNALS:
|
2019-09-24 08:48:08 +00:00
|
|
|
void clientManaging(KWin::X11Client *);
|
|
|
|
void clientFullScreenSet(KWin::X11Client *, bool, bool);
|
2015-01-08 11:45:40 +00:00
|
|
|
|
2012-11-09 12:44:50 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the Client want to show it menu
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-09 12:44:50 +00:00
|
|
|
void showRequest();
|
|
|
|
/**
|
|
|
|
* Emitted whenever the Client's menu is closed
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-09 12:44:50 +00:00
|
|
|
void menuHidden();
|
|
|
|
/**
|
|
|
|
* Emitted whenever the Client's menu is available
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-09 12:44:50 +00:00
|
|
|
void appMenuAvailable();
|
|
|
|
/**
|
|
|
|
* Emitted whenever the Client's menu is unavailable
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-09 12:44:50 +00:00
|
|
|
void appMenuUnavailable();
|
|
|
|
|
2012-03-31 17:09:00 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the Client's block compositing state changes.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-09-24 08:48:08 +00:00
|
|
|
void blockingCompositingChanged(KWin::X11Client *client);
|
2014-07-01 13:44:02 +00:00
|
|
|
void clientSideDecoratedChanged();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1
|
|
|
|
bool isManaged() const; ///< Returns false if this client is not yet managed
|
|
|
|
void updateAllowedActions(bool force = false);
|
|
|
|
QRect fullscreenMonitorsArea(NETFullscreenMonitors topology) const;
|
2015-10-13 08:22:18 +00:00
|
|
|
void changeMaximize(bool horizontal, bool vertical, bool adjust) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void getWmNormalHints();
|
|
|
|
void getMotifHints();
|
|
|
|
void getIcons();
|
|
|
|
void fetchName();
|
|
|
|
void fetchIconicName();
|
|
|
|
QString readName() const;
|
|
|
|
void setCaption(const QString& s, bool force = false);
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
bool hasTransientInternal(const X11Client *c, bool indirect, QList<const X11Client *> &set) const;
|
2017-07-21 18:22:56 +00:00
|
|
|
void setShortcutInternal() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool);
|
|
|
|
NETExtendedStrut strut() const;
|
|
|
|
int checkShadeGeometry(int w, int h);
|
|
|
|
void getSyncCounter();
|
|
|
|
void sendSyncRequest();
|
2015-10-22 13:58:24 +00:00
|
|
|
void leaveMoveResize() override;
|
2015-10-23 10:27:06 +00:00
|
|
|
void positionGeometryTip() override;
|
2020-07-16 11:01:08 +00:00
|
|
|
void establishCommandWindowGrab(uint8_t button);
|
|
|
|
void establishCommandAllGrab(uint8_t button);
|
2014-07-25 11:14:53 +00:00
|
|
|
void resizeDecoration();
|
2020-02-25 12:57:44 +00:00
|
|
|
void createDecoration(const QRect &oldgeom) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void pingWindow();
|
2013-05-03 09:02:06 +00:00
|
|
|
void killProcess(bool ask, xcb_timestamp_t timestamp = XCB_TIME_CURRENT_TIME);
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateUrgency();
|
2013-05-03 08:55:37 +00:00
|
|
|
static void sendClientMessage(xcb_window_t w, xcb_atom_t a, xcb_atom_t protocol,
|
2020-05-22 12:56:20 +00:00
|
|
|
uint32_t data1 = 0, uint32_t data2 = 0, uint32_t data3 = 0);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2014-04-25 11:42:52 +00:00
|
|
|
void embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, uint8_t depth);
|
2011-01-30 14:34:42 +00:00
|
|
|
void detectNoBorder();
|
2015-12-03 12:24:44 +00:00
|
|
|
void destroyDecoration() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateFrameExtents();
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
void setClientFrameExtents(const NETStrut &strut);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
void internalShow();
|
|
|
|
void internalHide();
|
|
|
|
void internalKeep();
|
|
|
|
void map();
|
|
|
|
void unmap();
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateHiddenPreview();
|
2019-12-02 17:36:13 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateInputShape();
|
2019-12-03 07:33:14 +00:00
|
|
|
void updateServerGeometry();
|
[x11] Fix visual artifacts during interactive resize
Summary:
When a window is being interactively resized, its contents may jump. The
reason why that happens is because KWin renders partially resized client
window. Composite extension spec says that a window will get a new pixmap
each time it is resized or mapped. This applies to the frame window, but
not to the client window itself. If the client window is resized,
off-screen storage for the frame window won't be reallocated. Therefore,
KWin may render partially resized client window if the client doesn't
attempt to be in sync with our rendering loop. Currently, the only way
to do that is to use extended frame counters, which are not supported by
KWin.
So, in order to fix visual artifacts during interactive resize, we need
somehow forcefully re-allocate off-screen storage for the frame window.
Unfortunately, Composite extension doesn't provide any request to do
that, so the only option we have is to resize the frame window.
BUG: 415839
FIXED-IN: 5.18.0
Reviewers: #kwin
Subscribers: davidedmundson, ngraham, alexde, fredrik, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D26914
2020-02-03 11:29:43 +00:00
|
|
|
void updateWindowPixmap();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-05-03 09:29:50 +00:00
|
|
|
xcb_timestamp_t readUserTimeMapTimestamp(const KStartupInfoId* asn_id, const KStartupInfoData* asn_data,
|
2011-01-30 14:34:42 +00:00
|
|
|
bool session) const;
|
2013-05-03 09:29:50 +00:00
|
|
|
xcb_timestamp_t readUserCreationTime() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
void startupIdChanged();
|
|
|
|
|
2011-11-09 19:39:13 +00:00
|
|
|
void updateInputWindow();
|
|
|
|
|
2015-01-15 14:51:21 +00:00
|
|
|
Xcb::Property fetchShowOnScreenEdge() const;
|
|
|
|
void readShowOnScreenEdge(Xcb::Property &property);
|
2014-02-20 11:39:23 +00:00
|
|
|
/**
|
|
|
|
* Reads the property and creates/destroys the screen edge if required
|
|
|
|
* and shows/hides the client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-02-20 11:39:23 +00:00
|
|
|
void updateShowOnScreenEdge();
|
|
|
|
|
2013-09-10 05:27:39 +00:00
|
|
|
Xcb::Window m_client;
|
2013-05-02 16:26:05 +00:00
|
|
|
Xcb::Window m_wrapper;
|
2013-09-10 06:13:33 +00:00
|
|
|
Xcb::Window m_frame;
|
2011-01-30 14:34:42 +00:00
|
|
|
QStringList activityList;
|
2013-03-24 20:57:26 +00:00
|
|
|
int m_activityUpdatesBlocked;
|
|
|
|
bool m_blockedActivityUpdatesRequireTransients;
|
2013-05-02 17:04:43 +00:00
|
|
|
Xcb::Window m_moveResizeGrabWindow;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool move_resize_has_keyboard_grab;
|
2012-06-19 21:12:37 +00:00
|
|
|
bool m_managed;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-01-21 15:05:29 +00:00
|
|
|
Xcb::GeometryHints m_geometryHints;
|
2011-01-30 14:34:42 +00:00
|
|
|
void sendSyntheticConfigureNotify();
|
|
|
|
enum MappingState {
|
|
|
|
Withdrawn, ///< Not handled, as per ICCCM WithdrawnState
|
|
|
|
Mapped, ///< The frame is mapped
|
|
|
|
Unmapped, ///< The frame is not mapped
|
|
|
|
Kept ///< The frame should be unmapped, but is kept (For compositing)
|
|
|
|
};
|
|
|
|
MappingState mapping_state;
|
|
|
|
|
2015-01-15 15:23:29 +00:00
|
|
|
Xcb::TransientFor fetchTransient() const;
|
|
|
|
void readTransientProperty(Xcb::TransientFor &transientFor);
|
2011-01-30 14:34:42 +00:00
|
|
|
void readTransient();
|
2013-05-03 06:53:35 +00:00
|
|
|
xcb_window_t verifyTransientFor(xcb_window_t transient_for, bool set);
|
2015-09-14 08:55:27 +00:00
|
|
|
void addTransient(AbstractClient* cl) override;
|
|
|
|
void removeTransient(AbstractClient* cl) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
void removeFromMainClients();
|
|
|
|
void cleanGrouping();
|
|
|
|
void checkGroupTransients();
|
2013-05-03 06:53:35 +00:00
|
|
|
void setTransient(xcb_window_t new_transient_for_id);
|
|
|
|
xcb_window_t m_transientForId;
|
|
|
|
xcb_window_t m_originalTransientForId;
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *shade_below;
|
2015-02-02 13:56:21 +00:00
|
|
|
Xcb::MotifHints m_motif;
|
2011-01-30 14:34:42 +00:00
|
|
|
uint hidden : 1; ///< Forcibly hidden by calling hide()
|
|
|
|
uint noborder : 1;
|
|
|
|
uint app_noborder : 1; ///< App requested no border via window type, shape extension, etc.
|
|
|
|
uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
|
2011-03-20 14:42:05 +00:00
|
|
|
bool blocks_compositing;
|
2019-01-10 15:01:42 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
enum FullScreenMode {
|
|
|
|
FullScreenNone,
|
2019-01-10 15:01:42 +00:00
|
|
|
FullScreenNormal
|
|
|
|
} m_fullscreenMode;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
MaximizeMode max_mode;
|
2019-12-02 17:36:13 +00:00
|
|
|
QRect m_bufferGeometry = QRect(0, 0, 100, 100);
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect geom_fs_restore;
|
2013-05-03 09:46:18 +00:00
|
|
|
xcb_colormap_t m_colormap;
|
2017-08-02 16:41:38 +00:00
|
|
|
QString cap_normal, cap_iconic, cap_suffix;
|
2011-01-30 14:34:42 +00:00
|
|
|
Group* in_group;
|
|
|
|
QTimer* ping_timer;
|
2012-04-16 21:52:13 +00:00
|
|
|
qint64 m_killHelperPID;
|
2013-05-03 09:35:46 +00:00
|
|
|
xcb_timestamp_t m_pingTimestamp;
|
2013-05-03 09:29:50 +00:00
|
|
|
xcb_timestamp_t m_userTime;
|
2014-02-03 08:37:08 +00:00
|
|
|
NET::Actions allowed_actions;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool shade_geometry_change;
|
2020-01-28 19:46:09 +00:00
|
|
|
SyncRequest m_syncRequest;
|
2019-09-24 08:48:08 +00:00
|
|
|
static bool check_active_modal; ///< \see X11Client::checkActiveModal()
|
2011-01-30 14:34:42 +00:00
|
|
|
int sm_stacking_order;
|
|
|
|
friend struct ResetupRulesProcedure;
|
|
|
|
|
|
|
|
friend bool performTransiencyCheck();
|
|
|
|
|
2015-01-15 15:31:20 +00:00
|
|
|
Xcb::StringProperty fetchActivities() const;
|
|
|
|
void readActivities(Xcb::StringProperty &property);
|
2011-01-30 14:34:42 +00:00
|
|
|
void checkActivities();
|
|
|
|
bool activitiesDefined; //whether the x property was actually set
|
|
|
|
|
2017-04-27 10:18:41 +00:00
|
|
|
bool sessionActivityOverride;
|
2012-11-07 23:54:05 +00:00
|
|
|
bool needsXWindowMove;
|
2011-11-09 19:39:13 +00:00
|
|
|
|
2013-02-04 10:20:15 +00:00
|
|
|
Xcb::Window m_decoInputExtent;
|
2011-11-09 19:39:13 +00:00
|
|
|
QPoint input_offset;
|
2013-08-05 07:48:14 +00:00
|
|
|
|
|
|
|
QTimer *m_focusOutTimer;
|
2013-10-14 05:17:07 +00:00
|
|
|
|
2014-02-26 10:26:00 +00:00
|
|
|
QList<QMetaObject::Connection> m_connections;
|
2015-10-11 20:48:29 +00:00
|
|
|
|
|
|
|
QMetaObject::Connection m_edgeRemoveConnection;
|
2017-03-08 22:54:58 +00:00
|
|
|
QMetaObject::Connection m_edgeGeometryTrackingConnection;
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
|
|
|
|
QMargins m_clientFrameExtents;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline xcb_window_t X11Client::wrapperId() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-02 16:26:05 +00:00
|
|
|
return m_wrapper;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::isClientSideDecorated() const
|
2014-07-01 13:44:02 +00:00
|
|
|
{
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
return !m_clientFrameExtents.isNull();
|
2014-07-01 13:44:02 +00:00
|
|
|
}
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::groupTransient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-03 06:53:35 +00:00
|
|
|
return m_transientForId == rootWindow();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
// Needed because verifyTransientFor() may set transient_for_id to root window,
|
2007-04-29 17:35:43 +00:00
|
|
|
// if the original value has a problem (window doesn't exist, etc.)
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::wasOriginallyGroupTransient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-03 06:53:35 +00:00
|
|
|
return m_originalTransientForId == rootWindow();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::isTransient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-03 06:53:35 +00:00
|
|
|
return m_transientForId != XCB_WINDOW_NONE;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline const Group* X11Client::group() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return in_group;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline Group* X11Client::group()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return in_group;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::isShown(bool shaded_is_shown) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-09-14 08:58:12 +00:00
|
|
|
return !isMinimized() && (!isShade() || shaded_is_shown) && !hidden;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::isHiddenInternal() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-02-23 13:41:53 +00:00
|
|
|
return hidden;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-02-23 13:41:53 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline MaximizeMode X11Client::maximizeMode() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return max_mode;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::isFullScreen() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-01-10 12:16:01 +00:00
|
|
|
return m_fullscreenMode != FullScreenNone;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::hasNETSupport() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return info->hasNETSupport();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline xcb_colormap_t X11Client::colormap() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-03 09:46:18 +00:00
|
|
|
return m_colormap;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline int X11Client::sessionStackingOrder() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return sm_stacking_order;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::isManaged() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-06-19 21:12:37 +00:00
|
|
|
return m_managed;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline void X11Client::plainResize(const QSize& s, ForceGeometry_t force)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-12-22 18:38:52 +00:00
|
|
|
plainResize(s.width(), s.height(), force);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-03-25 15:15:23 +00:00
|
|
|
inline void X11Client::resizeWithChecks(const QSize &s, AbstractClient::ForceGeometry_t force)
|
2015-05-27 09:48:33 +00:00
|
|
|
{
|
2020-03-25 15:15:23 +00:00
|
|
|
resizeWithChecks(s.width(), s.height(), XCB_GRAVITY_BIT_FORGET, force);
|
2015-05-27 09:48:33 +00:00
|
|
|
}
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline void X11Client::resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2015-01-21 15:05:29 +00:00
|
|
|
resizeWithChecks(s.width(), s.height(), gravity, force);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::hasUserTimeSupport() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return info->userTime() != -1U;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-12-18 13:50:57 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline xcb_window_t X11Client::moveResizeGrabWindow() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-02 17:04:43 +00:00
|
|
|
return m_moveResizeGrabWindow;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool X11Client::hiddenPreview() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-08-12 11:02:58 +00:00
|
|
|
return mapping_state == Kept;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-07-04 09:51:10 +00:00
|
|
|
|
2013-02-14 14:19:35 +00:00
|
|
|
template <typename T>
|
2019-09-24 08:48:08 +00:00
|
|
|
inline void X11Client::print(T &stream) const
|
2013-02-14 14:19:35 +00:00
|
|
|
{
|
2018-09-16 20:45:17 +00:00
|
|
|
stream << "\'Client:" << window() << ";WMCLASS:" << resourceClass() << ":"
|
2013-02-14 14:19:35 +00:00
|
|
|
<< resourceName() << ";Caption:" << caption() << "\'";
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
2019-09-24 08:48:08 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::X11Client *)
|
|
|
|
Q_DECLARE_METATYPE(QList<KWin::X11Client *>)
|