From e723b954a469767c29d6ff5b6fa8681ad1ae463d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 14 Oct 2016 14:02:44 +0200 Subject: [PATCH 1/2] fix namespaced build. *again* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3cbc3efdac61a9f329d0796c64885e6565bd0b77 Reviewed-by: Giulio Camuffo Reviewed-by: Jędrzej Nowacki --- src/plugins/platforms/wayland/global/qwaylandclientextension.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/global/qwaylandclientextension.h b/src/plugins/platforms/wayland/global/qwaylandclientextension.h index afb3f868fba..3d80baaa1ac 100644 --- a/src/plugins/platforms/wayland/global/qwaylandclientextension.h +++ b/src/plugins/platforms/wayland/global/qwaylandclientextension.h @@ -40,6 +40,7 @@ #include #include +struct wl_interface; struct wl_registry; QT_BEGIN_NAMESPACE From cd36be21314471200f021474b1d00848541dd11e Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 10 Oct 2016 17:52:15 +0200 Subject: [PATCH 2/2] Client: Remove windows from keyboard focus list when destroyed This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag Note: The test still fails if run twice in a row, but it appears to be deterministic. Task-number: QTBUG-56187 Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5 Reviewed-by: Paul Olav Tvete (cherry picked from commit a33cc547055eb12c5efa82a6612cbf8793988b72) Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 6 ++++++ src/plugins/platforms/wayland/qwaylanddisplay_p.h | 3 ++- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a5e61e28a73..6e167f3030f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -421,6 +421,12 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic mLastKeyboardFocus = keyboardFocus; } +void QWaylandDisplay::handleWindowDestroyed(QWaylandWindow *window) +{ + if (mActiveWindows.contains(window)) + handleWindowDeactivated(window); +} + void QWaylandDisplay::handleWaylandSync() { // This callback is used to set the window activation because we may get an activate/deactivate diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index f4fb3fa56a8..2864b357d80 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -176,6 +176,7 @@ public: void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); + void handleWindowDestroyed(QWaylandWindow *window); public slots: void blockingReadEvents(); @@ -217,7 +218,7 @@ private: uint32_t mLastInputSerial; QWaylandInputDevice *mLastInputDevice; QPointer mLastInputWindow; - QWaylandWindow *mLastKeyboardFocus; + QPointer mLastKeyboardFocus; QVector mActiveWindows; struct wl_callback *mSyncCallback; static const wl_callback_listener syncCallbackListener; diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index eb9c1409415..7256451911f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -102,6 +102,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window) QWaylandWindow::~QWaylandWindow() { + mDisplay->handleWindowDestroyed(this); + delete mWindowDecoration; if (isInitialized())