diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-08-09 14:08:04 +0200 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2018-11-01 17:20:56 +0000 |
commit | d28c241ca1451812fafc0c761587abfa44405914 (patch) | |
tree | 67a51075bf409a2070362a4109888d94105c38ab /src/plugins/platforms/xcb/qxcbwindow.h | |
parent | ae0843eca0e7102390ceec43236cfe8c5724d278 (diff) |
xcb: cleanup _NET_WM_STATE handling
Use function name overloading for all of _NET_WM_STATE setters for
a mapped window, instead of few similar sounding functions, where all
do the same thing. For an unmapped window rename updateNetWmStateBeforeMap()
-> setNetWmStateOnUnmappedWindow(). Merge setNetWmStates(NetWmStates) into
setNetWmStateOnUnmappedWindow() and add a comment explaining why it does
what it does, as it was not obvious.
Internally there are 2 variants:
a) When a window is already mapped, to change the window state we send
XCB_CLIENT_MESSAGE(_NET_WM_STATE) messages to the root window as per EWMH
spec. The Window Manager MUST keep this property updated to reflect the
current state of the window. If this variant of the overload is called
while a window is not mapped yet, it does nothing. WM would ignore this
message anyway. The state change is not lost, it will be set later and
that is where the second variant comes in.
b) On an unmapped window we can set _NET_WM_STATE by using setNetWmStateOnUnmappedWindow().
This function will read QWindow properties and set all of them via one
xcb_change_property(_NET_WM_STATE) call. We do this inside QXcbWindow::show(),
where we know that QWindow state properties won't change anymore until
it gets mapped. Once it is mapped, we use the other variant.
This patch doesn't change any functionality, just makes the code easier
to follow.
Change-Id: I4f4703a35de083fcfd398112eabd0a5aec358e51
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d2ca9fe0b9..f98cd8a74d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -193,17 +193,16 @@ protected: void setImageFormatForVisual(const xcb_visualtype_t *visual); QXcbScreen *parentScreen(); - QXcbScreen *initialScreen() const; - void changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); + + void setNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); + void setNetWmState(Qt::WindowFlags flags); + void setNetWmState(Qt::WindowStates state); + void setNetWmStateOnUnmappedWindow(); NetWmStates netWmStates(); - void setNetWmStates(NetWmStates); void setMotifWmHints(Qt::WindowFlags flags); - void setNetWmStateWindowFlags(Qt::WindowFlags flags); - void updateNetWmStateBeforeMap(); - void setTransparentForMouseEvents(bool transparent); void updateDoesNotAcceptFocus(bool doesNotAcceptFocus); |