From d8a8378248636060670c048edbf9933eed445d78 Mon Sep 17 00:00:00 2001 From: Christophe Chapuis Date: Mon, 21 Aug 2017 13:29:47 +0000 Subject: QWaylandWindow: reset window should reset mask When QWaylandWindow::reset() is called, the window's mask is not changed. It means that when the window will be initialized again, it will not re-send the mask description to the server side through Wayland. Task-number: QTBUG-62638 Change-Id: I07d561f466836bbd90ae58521c0768ed85554256 Reviewed-by: Johan Helsing Reviewed-by: Christophe Chapuis --- src/client/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/client/qwaylandwindow.cpp') diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index e5edd0e5e..f7f296d0a 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -254,6 +254,8 @@ void QWaylandWindow::reset() wl_callback_destroy(mFrameCallback); mFrameCallback = nullptr; } + + mMask = QRegion(); } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) -- cgit v1.2.3 From a5c4af696b4fa0747b278830d07f4360e73b1f63 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 19 Oct 2017 12:13:01 +0200 Subject: Ensure QWaylandWindow::transientParent has a shell surface This may not be a perfect solution, but it's better than the current one, where the transient parent may not have a shell surface (because the window may be hidden or not yet initialized). Task-number: QTBUG-63840 Change-Id: Ia5f04376d4b6d12b41ceeab5ba13cdc1b63b4e3c Reviewed-by: Paul Olav Tvete --- src/client/qwaylandwindow.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/client/qwaylandwindow.cpp') diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index f7f296d0a..6d7c0885c 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -785,22 +785,27 @@ QWaylandAbstractDecoration *QWaylandWindow::decoration() const return mWindowDecoration; } -static QWindow *topLevelWindow(QWindow *window) +static QWaylandWindow *closestShellSurfaceWindow(QWindow *window) { - while (QWindow *parent = window->parent()) - window = parent; - return window; + while (window) { + auto w = static_cast(window->handle()); + if (w->shellSurface()) + return w; + window = window->transientParent() ? window->transientParent() : window->parent(); + } + return nullptr; } QWaylandWindow *QWaylandWindow::transientParent() const { - // Take the top level window here, since the transient parent may be a QWidgetWindow - // or some other window without a shell surface, which is then not able to get mouse - // events. - if (auto transientParent = window()->transientParent()) - return static_cast(topLevelWindow(transientParent)->handle()); - else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) - return static_cast(topLevelWindow(QGuiApplication::focusWindow())->handle()); + // Take the closest window with a shell surface, since the transient parent may be a + // QWidgetWindow or some other window without a shell surface, which is then not able to + // get mouse events. + if (auto transientParent = closestShellSurfaceWindow(window()->transientParent())) + return transientParent; + + if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) + return closestShellSurfaceWindow(QGuiApplication::focusWindow()); return nullptr; } -- cgit v1.2.3