diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-01-22 10:19:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-19 21:21:27 +0100 |
commit | 3f99983e76d359cb45b15ae96150d4cc798b61c7 (patch) | |
tree | b708416ff3427576b85b533138310762d4c2c459 /src/plugins/platforms/xcb/qxcbwindow.cpp | |
parent | 18f9eb797bffe8626f1edeca3c88f80dae0da8d7 (diff) |
Fix focus handling of native child widgets in xcb.
Change-Id: If4d596195624011142bff6853849a23064e478df
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
(cherry picked from commit fc663b5f9aae16fe6a03160e3eb148a5f742ac58)
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b7668e6270..c0ddf5c0ae 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -403,6 +403,9 @@ QXcbWindow::~QXcbWindow() void QXcbWindow::destroy() { + if (connection()->focusWindow() == this) + connection()->setFocusWindow(0); + if (m_syncCounter && m_screen->syncRequestSupported()) Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter)); if (m_window) { @@ -1473,6 +1476,11 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { + if (window() != QGuiApplication::focusWindow()) { + QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver(); + w->requestActivate(); + } + updateNetWmUserTime(event->time); QPoint local(event->event_x, event->event_y); @@ -1635,7 +1643,10 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *) { - QWindowSystemInterface::handleWindowActivated(window()); + QWindow *w = window(); + w = static_cast<QWindowPrivate *>(QObjectPrivate::get(w))->eventReceiver(); + connection()->setFocusWindow(static_cast<QXcbWindow *>(w->handle())); + QWindowSystemInterface::handleWindowActivated(w); } static bool focusInPeeker(xcb_generic_event_t *event) @@ -1651,6 +1662,7 @@ static bool focusInPeeker(xcb_generic_event_t *event) void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) { + connection()->setFocusWindow(0); // Do not set the active window to 0 if there is a FocusIn coming. // There is however no equivalent for XPutBackEvent so register a // callback for QXcbConnection instead. |