summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2014-02-05 12:41:40 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-09 20:03:37 +0100
commitab3637dd678d4d7fe94f91a927230cbdd91fe3b3 (patch)
tree6b23d1ffc9e79fd9d4f3698aea5e3f859358245a /src/plugins
parent54835e3ccf4e02c6e2607556fa2075df18cc753c (diff)
Do not set input focus if WM supports _NET_ACTIVE_WINDOW
In case the window manager supports _NET_ACTIVE_WINDOW a client message is sent to the root window and the window manager is expected to either activate the window or mark it with demands attention. In addition the code unconditionally also called xcb_set_input_focus which breaks the intention of sending the client message. Thus it is now only done if the WM doesn't support the protocol. This was also the logic in Qt 4.x in QWidget::activateWindow (qwidget_x11.cpp). In addition set_input_focus is only called if the window is a toplevel. Change-Id: Iec4c02f0ea62db30a4b347d474fdfd2f05b8895b Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 433d6d5948..a1e7bea0dd 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1375,6 +1375,7 @@ void QXcbWindow::requestActivateWindow()
updateNetWmUserTime(connection()->time());
if (window()->isTopLevel()
+ && !(window()->flags() & Qt::X11BypassWindowManagerHint)
&& connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_ACTIVE_WINDOW))) {
xcb_client_message_event_t event;
@@ -1390,10 +1391,10 @@ void QXcbWindow::requestActivateWindow()
event.data.data32[4] = 0;
Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, m_screen->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event));
+ } else {
+ Q_XCB_CALL(xcb_set_input_focus(xcb_connection(), XCB_INPUT_FOCUS_PARENT, m_window, connection()->time()));
}
- Q_XCB_CALL(xcb_set_input_focus(xcb_connection(), XCB_INPUT_FOCUS_PARENT, m_window, connection()->time()));
-
connection()->sync();
}