summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-08-05 10:59:51 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-08-08 10:43:53 +0000
commit1db3dee9432f28f35ec9c971444b8a889bbdd6e2 (patch)
tree10f2c887e9db33d9f9a19057a554c4754690bfe9
parentda364484aa51ce7c73d39ce0ca444169ce69588e (diff)
downloadqtwayland-1db3dee9432f28f35ec9c971444b8a889bbdd6e2.tar.gz
Client: Refactor window active state
Let shell surface implementations decide if they manage activated state. Moves the logic out of QWaylandDisplay. Change-Id: I75c86df68a1a93f9b1d2bf378b6603215d0b0128 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/client/qwaylanddisplay.cpp8
-rw-r--r--src/client/qwaylanddisplay_p.h1
-rw-r--r--src/client/qwaylandshellsurface_p.h1
-rw-r--r--src/client/qwaylandxdgsurface_p.h2
4 files changed, 4 insertions, 8 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index f6d86bb3..682172bf 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -385,12 +385,6 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s
mLastInputWindow = win;
}
-bool QWaylandDisplay::shellManagesActiveState() const
-{
- //TODO: This should be part of a shell interface used by the shell protocol implementations
- return mShellXdg;
-}
-
void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window)
{
if (mActiveWindows.contains(window))
@@ -414,7 +408,7 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
{
QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus();
- if (!shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) {
+ if (!keyboardFocus->shellSurface()->shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) {
if (keyboardFocus)
handleWindowActivated(keyboardFocus);
if (mLastKeyboardFocus)
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 237be5b7..3f5538ec 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -169,7 +169,6 @@ public:
QWaylandWindow *lastInputWindow() const;
void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window);
- bool shellManagesActiveState() const;
void handleWindowActivated(QWaylandWindow *window);
void handleWindowDeactivated(QWaylandWindow *window);
void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice);
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h
index 726d103f..c99e586d 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -85,6 +85,7 @@ public:
virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) }
virtual void sendProperty(const QString &name, const QVariant &value);
+ virtual bool shellManagesActiveState() const { return false; }
inline QWaylandWindow *window() { return m_window; }
diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h
index e367980b..bc72820a 100644
--- a/src/client/qwaylandxdgsurface_p.h
+++ b/src/client/qwaylandxdgsurface_p.h
@@ -89,6 +89,8 @@ public:
void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE;
+ bool shellManagesActiveState() const Q_DECL_OVERRIDE { return true; }
+
bool isFullscreen() const { return m_fullscreen; }
bool isMaximized() const { return m_maximized; }