summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-08-07 18:09:25 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2018-10-15 18:33:55 +0000
commit03b1380613d581863727a76db62dca974b55682b (patch)
tree2785859f1867ac8c9befb2a1e11cdd3273428f79 /src/plugins/platforms/xcb
parent4aa86d38ef9cf852db987bc4d560746363a705b8 (diff)
xcb: cleanup WM_HINTS handling
- The only place where window flag Qt::WindowDoesNotAcceptFocus changes is inside QXcbWindow::setWindowFlags and from there we call updateDoesNotAcceptFocus(). The current code was redundantly calling xcb_wm_hints_set_input in various places. - Similar as above: call xcb_wm_hints_set_normal/iconic only where it can change. This hint depends on window state, so update it only from setWindowState(). Removed unnecessary call to setTransparentForMouseEvents(), which is already called few lines above from setWindowFlags(). Change-Id: I8da919b135a4dfda0c8c1dad51d85d3e706153ab Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 772309c6ae..f36bb5a51e 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -499,12 +499,10 @@ void QXcbWindow::create()
clientMachine.size(), clientMachine.constData());
}
+ // Create WM_HINTS property on the window, so we can xcb_get_wm_hints*()
+ // from various setter functions for adjusting the hints.
xcb_wm_hints_t hints;
memset(&hints, 0, sizeof(hints));
- xcb_wm_hints_set_normal(&hints);
-
- xcb_wm_hints_set_input(&hints, !(window()->flags() & Qt::WindowDoesNotAcceptFocus));
-
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
xcb_window_t leader = connection()->clientLeader();
@@ -532,9 +530,6 @@ void QXcbWindow::create()
setWindowFlags(window()->flags());
setWindowTitle(window()->title());
- if (window()->flags() & Qt::WindowTransparentForInput)
- setTransparentForMouseEvents(true);
-
#if QT_CONFIG(xcb_xlib)
// force sync to read outstanding requests - see QTBUG-29106
XSync(static_cast<Display*>(platformScreen->connection()->xlib_display()), false);
@@ -739,20 +734,6 @@ void QXcbWindow::show()
{
if (window()->isTopLevel()) {
- xcb_get_property_cookie_t cookie = xcb_get_wm_hints_unchecked(xcb_connection(), m_window);
-
- xcb_wm_hints_t hints;
- xcb_get_wm_hints_reply(xcb_connection(), cookie, &hints, NULL);
-
- if (window()->windowStates() & Qt::WindowMinimized)
- xcb_wm_hints_set_iconic(&hints);
- else
- xcb_wm_hints_set_normal(&hints);
-
- xcb_wm_hints_set_input(&hints, !(window()->flags() & Qt::WindowDoesNotAcceptFocus));
-
- xcb_set_wm_hints(xcb_connection(), m_window, &hints);
-
// update WM_NORMAL_HINTS
propagateSizeHints();
@@ -1230,6 +1211,16 @@ void QXcbWindow::setWindowState(Qt::WindowStates state)
changeNetWmState(state & Qt::WindowFullScreen, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN));
}
+ xcb_get_property_cookie_t cookie = xcb_get_wm_hints_unchecked(xcb_connection(), m_window);
+ xcb_wm_hints_t hints;
+ if (xcb_get_wm_hints_reply(xcb_connection(), cookie, &hints, nullptr)) {
+ if (state & Qt::WindowMinimized)
+ xcb_wm_hints_set_iconic(&hints);
+ else
+ xcb_wm_hints_set_normal(&hints);
+ xcb_set_wm_hints(xcb_connection(), m_window, &hints);
+ }
+
connection()->sync();
m_windowState = state;
}
@@ -1402,9 +1393,8 @@ void QXcbWindow::updateDoesNotAcceptFocus(bool doesNotAcceptFocus)
xcb_get_property_cookie_t cookie = xcb_get_wm_hints_unchecked(xcb_connection(), m_window);
xcb_wm_hints_t hints;
- if (!xcb_get_wm_hints_reply(xcb_connection(), cookie, &hints, NULL)) {
+ if (!xcb_get_wm_hints_reply(xcb_connection(), cookie, &hints, nullptr))
return;
- }
xcb_wm_hints_set_input(&hints, !doesNotAcceptFocus);
xcb_set_wm_hints(xcb_connection(), m_window, &hints);