diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-08-27 09:25:50 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-08-28 07:00:44 +0000 |
commit | aa341afd9b428f5ad2d0bc1c16d9cda64a4b04fb (patch) | |
tree | f56fc2155695d440c532cdb71d90d0798bd0162b /src/client | |
parent | de4f9ebea3207e5d7e87390b512f9ae8bb7636cc (diff) |
Client: Fix regression; drawing decorations of active windows as inactive
We can't trust QWindow::isActive, because it relies on focusWindow, which may
be updated too late, and there might also be multiple active toplevel windows
at once on Wayland. Even though Qt doesn't support multiple seats, we should
still draw the decorations of active windows correctly.
This implements QPlatformWindow::isActive and uses it in the decorations.
Change-Id: I34d79b354e2d26694533e2319a26f24085212243
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 5 | ||||
-rw-r--r-- | src/client/qwaylanddisplay_p.h | 1 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 5 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 1 |
4 files changed, 12 insertions, 0 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 5e67cd3a6..c57dc13ad 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -413,6 +413,11 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s mLastInputWindow = win; } +bool QWaylandDisplay::isWindowActivated(const QWaylandWindow *window) +{ + return mActiveWindows.contains(const_cast<QWaylandWindow *>(window)); +} + void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window) { if (mActiveWindows.contains(window)) diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 8839bbe4c..71a39dd92 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -176,6 +176,7 @@ public: QWaylandWindow *lastInputWindow() const; void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window); + bool isWindowActivated(const QWaylandWindow *window); void handleWindowActivated(QWaylandWindow *window); void handleWindowDeactivated(QWaylandWindow *window); void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice); diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 760390917..e58e87221 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -943,6 +943,11 @@ bool QWaylandWindow::isExposed() const return QPlatformWindow::isExposed(); } +bool QWaylandWindow::isActive() const +{ + return mDisplay->isWindowActivated(this); +} + int QWaylandWindow::scale() const { return mScale; diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index b6b499a3b..d11ed871b 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -146,6 +146,7 @@ public: void requestActivateWindow() override; bool isExposed() const override; + bool isActive() const override; void unfocus(); QWaylandAbstractDecoration *decoration() const; |