diff options
author | Méven Car <meven.car@enioka.com> | 2021-08-18 18:28:20 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2021-10-04 11:12:52 +0200 |
commit | 40036a1b80e5234e6db7d5cbeff122aa7ee13e20 (patch) | |
tree | 9fada2bc7ef3c81ca8c447d73f270207829d0e77 /src/client/qwaylandwindow.cpp | |
parent | 0a4c1f25b5afbafc45d75b699be894d2f1eaf483 (diff) | |
download | qtwayland-40036a1b80e5234e6db7d5cbeff122aa7ee13e20.tar.gz |
Wayland client: use wl_keyboard to determine active state
Commit f497a5bb87270174b8e0106b7eca1992d44ff15d made QWaylandDisplay
use the xdgshell's active state for QWindow::isActive(), instead of
using wl_keyboard activate/deactivate events.
That seems to have been a misunderstanding, since xdgshell activation
is only supposed to be used to determine visual appearance, and there
is an explicit warning not to assume it means focus.
This commit reverts this logic back to listening to wl_keyboard.
It adds a fallback when there is no wl_keyboard available to handle
activated/deactivated events through xdg-shell, in order to fix
QTBUG-53702.
windowStates is handled so that we're not using the Xdg hint for
anything with QWindowSystemInterface::handleWindowStateChanged or
anything where we need to track only having one active.
We are still exposing it for decorations, which is the only reason to
use the Xdghint over keyboard focus - so you can keep the toplevel
active whilst you show a popup.
Change-Id: I4343d2ed9fb5b066cde95628ed0b4ccc84a424db
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 5561f58f..7f4088aa 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -96,7 +96,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) QWaylandWindow::~QWaylandWindow() { mDisplay->destroyFrameQueue(mFrameQueue); - mDisplay->handleWindowDestroyed(this); delete mWindowDecoration; @@ -265,6 +264,8 @@ void QWaylandWindow::reset() mMask = QRegion(); mQueuedBuffer = nullptr; + + mDisplay->handleWindowDestroyed(this); } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) @@ -1273,7 +1274,10 @@ Qt::WindowStates QWaylandWindow::windowStates() const void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states) { createDecoration(); - QWindowSystemInterface::handleWindowStateChanged(window(), states, mLastReportedWindowStates); + Qt::WindowStates statesWithoutActive = states & ~Qt::WindowActive; + Qt::WindowStates lastStatesWithoutActive = mLastReportedWindowStates & ~Qt::WindowActive; + QWindowSystemInterface::handleWindowStateChanged(window(), statesWithoutActive, + lastStatesWithoutActive); mLastReportedWindowStates = states; } |