2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
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
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "decorationitem.h"
|
2022-01-13 13:54:03 +00:00
|
|
|
#include "utils/xcbutils.h"
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.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>
|
2013-04-26 09:52:15 +00:00
|
|
|
#include <QPixmap>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <QPointer>
|
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,
|
2021-03-14 17:06:22 +00:00
|
|
|
InputIdMatch,
|
2014-03-20 08:19:53 +00:00
|
|
|
};
|
|
|
|
|
2021-04-26 16:38:40 +00:00
|
|
|
/**
|
|
|
|
* @todo Remove when the X11 platform support is dropped. This decoration renderer
|
|
|
|
* will be used if compositing is off.
|
|
|
|
*/
|
|
|
|
class X11DecorationRenderer : public DecorationRenderer
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit X11DecorationRenderer(Decoration::DecoratedClientImpl *client);
|
|
|
|
~X11DecorationRenderer() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void render(const QRegion ®ion) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void update();
|
|
|
|
|
|
|
|
QTimer *m_scheduleTimer;
|
|
|
|
xcb_gcontext_t m_gc;
|
|
|
|
};
|
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
class KWIN_EXPORT X11Window : public Window
|
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
|
|
|
*/
|
2022-05-16 20:13:39 +00:00
|
|
|
Q_PROPERTY(QSizeF 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:
|
2022-04-22 17:54:31 +00:00
|
|
|
explicit X11Window();
|
2022-04-23 08:33:23 +00:00
|
|
|
~X11Window() override; ///< Use destroyWindow() or releaseWindow()
|
2020-04-27 18:44:12 +00:00
|
|
|
|
2013-05-02 16:26:05 +00:00
|
|
|
xcb_window_t wrapperId() const;
|
2022-03-23 10:13:38 +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
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QRectF inputGeometry() const override;
|
2019-10-03 19:43:28 +00:00
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QPointF framePosToClientPos(const QPointF &point) const override;
|
|
|
|
QPointF clientPosToFramePos(const QPointF &point) const override;
|
|
|
|
QSizeF frameSizeToClientSize(const QSizeF &size) const override;
|
|
|
|
QSizeF clientSizeToFrameSize(const QSizeF &size) const override;
|
|
|
|
QRectF frameRectToBufferRect(const QRectF &rect) const;
|
2022-07-18 08:23:54 +00:00
|
|
|
QSizeF implicitSize() 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;
|
2022-04-23 08:33:23 +00:00
|
|
|
QList<Window *> mainWindows() const override; // Call once before loop , is not indirect
|
2022-04-22 17:39:12 +00:00
|
|
|
bool hasTransient(const Window *c, bool indirect) const override;
|
2013-05-03 06:53:35 +00:00
|
|
|
void checkTransient(xcb_window_t w);
|
2022-04-22 17:39:12 +00:00
|
|
|
Window *findModal(bool allow_itself = false) override;
|
2022-03-23 10:13:38 +00:00
|
|
|
const Group *group() const override;
|
|
|
|
Group *group() override;
|
|
|
|
void checkGroup(Group *gr = nullptr, bool force = false);
|
|
|
|
void changeClientLeaderGroup(Group *gr);
|
2020-08-20 11:31:48 +00:00
|
|
|
bool supportsWindowRules() const override;
|
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;
|
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QSizeF minSize() const override;
|
|
|
|
QSizeF maxSize() const override;
|
|
|
|
QSizeF basicUnit() const;
|
|
|
|
QPointF inputPos() const
|
2022-03-23 10:13:38 +00:00
|
|
|
{
|
|
|
|
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);
|
2022-04-23 08:33:23 +00:00
|
|
|
void destroyWindow() 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;
|
2021-03-09 14:04:20 +00:00
|
|
|
void doSetOnActivities(const QStringList &newActivitiesList) override;
|
|
|
|
void updateActivities(bool includeTransients) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/// Is not minimized and not hidden. I.e. normally visible on some virtual desktop.
|
2021-11-23 12:13:56 +00:00
|
|
|
bool isShown() 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;
|
2022-05-16 20:13:39 +00:00
|
|
|
QRectF 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;
|
2022-03-23 10:13:38 +00:00
|
|
|
int fullScreenMode() const
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2021-12-08 13:21:48 +00:00
|
|
|
void invalidateDecoration() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void updateShape();
|
|
|
|
|
|
|
|
/// resizeWithChecks() resizes according to gravity, and checks workarea position
|
2022-05-16 20:13:39 +00:00
|
|
|
void resizeWithChecks(const QSizeF &size) override;
|
|
|
|
void resizeWithChecks(qreal w, qreal h, xcb_gravity_t gravity);
|
|
|
|
void resizeWithChecks(const QSizeF &s, xcb_gravity_t gravity);
|
|
|
|
QSizeF constrainClientSize(const QSizeF &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
|
|
|
|
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
|
2021-11-03 09:40:31 +00:00
|
|
|
void hideClient() override;
|
|
|
|
void showClient() 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);
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool isBlockingCompositing()
|
|
|
|
{
|
|
|
|
return blocks_compositing;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QString captionNormal() const override
|
|
|
|
{
|
2017-08-20 06:56:13 +00:00
|
|
|
return cap_normal;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
QString captionSuffix() const override
|
|
|
|
{
|
2017-08-20 06:56:13 +00:00
|
|
|
return cap_suffix;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
using Window::keyPressEvent;
|
2022-03-23 10:13:38 +00:00
|
|
|
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
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QPointF gravityAdjustment(xcb_gravity_t gravity) const;
|
|
|
|
const QPointF 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);
|
2022-06-07 10:29:59 +00:00
|
|
|
void GTKShowWindowMenu(int x_root, int y_root);
|
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;'
|
2022-04-22 17:54:31 +00:00
|
|
|
static void deleteClient(X11Window *c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
static bool belongToSameApplication(const X11Window *c1, const X11Window *c2, SameApplicationChecks checks = SameApplicationChecks());
|
|
|
|
static bool sameAppWindowRoleMatch(const X11Window *c1, const X11Window *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();
|
2020-08-17 13:14:20 +00:00
|
|
|
|
|
|
|
StrutRect strutRect(StrutArea area) const override;
|
2015-06-19 22:14:15 +00:00
|
|
|
bool hasStrut() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2014-07-01 13:44:02 +00:00
|
|
|
bool isClientSideDecorated() const;
|
2012-10-12 09:34:05 +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();
|
2020-08-19 09:21:00 +00:00
|
|
|
Xcb::StringProperty fetchPreferredColorScheme() const;
|
|
|
|
QString readPreferredColorScheme(Xcb::StringProperty &property) const;
|
|
|
|
QString preferredColorScheme() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// sets whether the client should be faked as being on all activities (and be shown during session save)
|
2017-04-27 10:18:41 +00:00
|
|
|
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-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();
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct SyncRequest
|
|
|
|
{
|
2017-09-22 18:35:50 +00:00
|
|
|
xcb_sync_counter_t counter;
|
|
|
|
xcb_sync_int64_t value;
|
|
|
|
xcb_sync_alarm_t alarm;
|
|
|
|
xcb_timestamp_t lastTimestamp;
|
|
|
|
QTimer *timeout, *failsafeTimeout;
|
|
|
|
bool isPending;
|
2022-01-11 20:32:58 +00:00
|
|
|
bool interactiveResize;
|
2017-09-22 18:35:50 +00:00
|
|
|
};
|
2022-03-23 10:13:38 +00:00
|
|
|
const SyncRequest &syncRequest() const
|
|
|
|
{
|
2020-01-28 19:46:09 +00:00
|
|
|
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();
|
2021-05-25 06:32:55 +00:00
|
|
|
void handleSyncTimeout();
|
2017-09-22 18:35:50 +00:00
|
|
|
|
2022-05-04 23:49:53 +00:00
|
|
|
bool allowWindowActivation(xcb_timestamp_t time = -1U, bool focus_in = false,
|
|
|
|
bool ignore_desktop = false);
|
|
|
|
|
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);
|
2021-02-04 09:07:20 +00:00
|
|
|
void damageNotifyEvent();
|
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:
|
2022-04-22 17:39:12 +00:00
|
|
|
bool belongsToSameApplication(const Window *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;
|
2021-04-30 18:06:58 +00:00
|
|
|
bool doStartInteractiveMoveResize() override;
|
|
|
|
bool isWaitingForInteractiveMoveResizeSync() const override;
|
|
|
|
void doInteractiveResizeSync() override;
|
2022-05-16 20:13:39 +00:00
|
|
|
QSizeF resizeIncrements() const override;
|
2015-12-07 15:18:30 +00:00
|
|
|
bool acceptsFocus() const override;
|
2022-05-16 20:13:39 +00:00
|
|
|
void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override;
|
2022-05-09 15:47:12 +00:00
|
|
|
WindowItem *createItem() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// Signals for the scripting interface
|
|
|
|
// Signals make an excellent way for communication
|
|
|
|
// in between objects as compared to simple function
|
|
|
|
// calls
|
2013-07-22 14:07:39 +00:00
|
|
|
Q_SIGNALS:
|
2022-04-22 17:54:31 +00:00
|
|
|
void clientManaging(KWin::X11Window *);
|
|
|
|
void clientFullScreenSet(KWin::X11Window *, 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
|
|
|
*/
|
2022-04-22 17:54:31 +00:00
|
|
|
void blockingCompositingChanged(KWin::X11Window *client);
|
2014-07-01 13:44:02 +00:00
|
|
|
void clientSideDecoratedChanged();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
private:
|
2022-03-23 10:13:38 +00:00
|
|
|
void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1
|
2011-01-30 14:34:42 +00:00
|
|
|
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;
|
2022-03-23 10:13:38 +00:00
|
|
|
void setCaption(const QString &s, bool force = false);
|
2022-04-22 17:54:31 +00:00
|
|
|
bool hasTransientInternal(const X11Window *c, bool indirect, QList<const X11Window *> &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();
|
2021-04-30 18:06:58 +00:00
|
|
|
void leaveInteractiveMoveResize() override;
|
2021-12-23 21:26:19 +00:00
|
|
|
void performInteractiveResize();
|
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();
|
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();
|
|
|
|
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();
|
2021-05-19 06:22:05 +00:00
|
|
|
void discardWindowPixmap();
|
[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
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
xcb_timestamp_t readUserTimeMapTimestamp(const KStartupInfoId *asn_id, const KStartupInfoData *asn_data,
|
|
|
|
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();
|
|
|
|
|
2021-04-26 16:38:40 +00:00
|
|
|
void maybeCreateX11DecorationRenderer();
|
|
|
|
void maybeDestroyX11DecorationRenderer();
|
2021-12-08 13:28:43 +00:00
|
|
|
void updateDecoration(bool check_workspace_pos, bool force = false);
|
2022-05-16 20:13:39 +00:00
|
|
|
void createDecoration(const QRectF &oldgeom);
|
2021-12-09 11:55:13 +00:00
|
|
|
void destroyDecoration();
|
2021-04-26 16:38:40 +00:00
|
|
|
|
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;
|
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);
|
2022-04-22 17:39:12 +00:00
|
|
|
void addTransient(Window *cl) override;
|
|
|
|
void removeTransient(Window *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;
|
2022-04-22 17:54:31 +00:00
|
|
|
X11Window *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;
|
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;
|
2022-03-23 10:13:38 +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;
|
2022-04-22 17:54:31 +00:00
|
|
|
static bool check_active_modal; ///< \see X11Window::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();
|
2022-03-23 10:13:38 +00:00
|
|
|
bool activitiesDefined; // whether the x property was actually set
|
2011-01-30 14:34:42 +00:00
|
|
|
|
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;
|
2022-05-16 20:13:39 +00:00
|
|
|
QPointF input_offset;
|
2013-08-05 07:48:14 +00:00
|
|
|
|
|
|
|
QTimer *m_focusOutTimer;
|
2013-10-14 05:17:07 +00:00
|
|
|
|
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
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QMarginsF m_clientFrameExtents;
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *m_lastOutput = nullptr;
|
2022-05-16 20:13:39 +00:00
|
|
|
QRectF m_lastBufferGeometry;
|
|
|
|
QRectF m_lastFrameGeometry;
|
|
|
|
QRectF m_lastClientGeometry;
|
2021-04-26 16:38:40 +00:00
|
|
|
QScopedPointer<X11DecorationRenderer> m_decorationRenderer;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline xcb_window_t X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
}
|
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::groupTransient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2022-02-08 22:28:03 +00:00
|
|
|
return m_transientForId == kwinApp()->x11RootWindow();
|
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.)
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::wasOriginallyGroupTransient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2022-02-08 22:28:03 +00:00
|
|
|
return m_originalTransientForId == kwinApp()->x11RootWindow();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline const Group *X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline Group *X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::isShown() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2021-11-23 12:13:56 +00:00
|
|
|
return !isMinimized() && !hidden;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline MaximizeMode X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline xcb_colormap_t X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline int X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
inline void X11Window::resizeWithChecks(const QSizeF &s)
|
2015-05-27 09:48:33 +00:00
|
|
|
{
|
2021-04-25 08:52:30 +00:00
|
|
|
resizeWithChecks(s.width(), s.height(), XCB_GRAVITY_BIT_FORGET);
|
2015-05-27 09:48:33 +00:00
|
|
|
}
|
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
inline void X11Window::resizeWithChecks(const QSizeF &s, xcb_gravity_t gravity)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2021-04-25 08:52:30 +00:00
|
|
|
resizeWithChecks(s.width(), s.height(), gravity);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline xcb_window_t X11Window::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
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
inline bool X11Window::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
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
2022-04-22 17:54:31 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::X11Window *)
|
|
|
|
Q_DECLARE_METATYPE(QList<KWin::X11Window *>)
|