summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-11-04 10:32:01 +0100
committerJohan Helsing <johan.helsing@qt.io>2016-11-10 15:32:07 +0000
commit70740da8978cb87b269fcaa73d71595c3c396545 (patch)
tree3429028a9e0786a5766039b971a74005b815bb0e
parentc88b5f632c767bee17c8b8df60af3d11724b2e5b (diff)
Remove QWaylandWindow::shellManagesActiveState
If m_shellSurface was deleted, there was no way for QWaylandDisplay to know whether the shell handled window deactivation or not. The shell integration now always handles the window active state. The default implementation of QWaylandShellIntegration will make a window active on keyboard focus. Change-Id: I80cfce9976b1d3c57094fdd8980c9110b873f239 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/client/qwaylanddisplay.cpp6
-rw-r--r--src/client/qwaylandshellsurface_p.h1
-rw-r--r--src/client/qwaylandwindow.cpp5
-rw-r--r--src/client/qwaylandwindow_p.h2
-rw-r--r--src/client/qwaylandwlshellintegration.cpp6
-rw-r--r--src/client/qwaylandwlshellintegration_p.h2
-rw-r--r--src/client/qwaylandxdgshellintegration.cpp13
-rw-r--r--src/client/qwaylandxdgshellintegration_p.h3
-rw-r--r--src/client/qwaylandxdgsurface_p.h2
-rw-r--r--src/client/shellintegration/qwaylandshellintegration_p.h15
-rw-r--r--src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp1
11 files changed, 38 insertions, 18 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 5f2c4e2e..de38e3f2 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -419,11 +419,7 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
if (mLastKeyboardFocus == keyboardFocus)
return;
- if (keyboardFocus && !keyboardFocus->shellManagesActiveState())
- handleWindowActivated(keyboardFocus);
-
- if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState())
- handleWindowDeactivated(mLastKeyboardFocus);
+ mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus);
mLastKeyboardFocus = keyboardFocus;
}
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h
index 79f65b15..63b77ab3 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -91,7 +91,6 @@ 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/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 6b9dde7c..e72ed770 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -530,11 +530,6 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
return mSubSurfaceWindow;
}
-bool QWaylandWindow::shellManagesActiveState() const
-{
- return mShellSurface && mShellSurface->shellManagesActiveState();
-}
-
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{
if (mDisplay->compositorVersion() < 2)
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index e0c42ace..442fe9ad 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -143,8 +143,6 @@ public:
QWaylandSubSurface *subSurfaceWindow() const;
QWaylandScreen *screen() const { return mScreen; }
- bool shellManagesActiveState() const;
-
void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE;
void setOrientationMask(Qt::ScreenOrientations mask);
diff --git a/src/client/qwaylandwlshellintegration.cpp b/src/client/qwaylandwlshellintegration.cpp
index 6a9220d2..ce7c7834 100644
--- a/src/client/qwaylandwlshellintegration.cpp
+++ b/src/client/qwaylandwlshellintegration.cpp
@@ -52,6 +52,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
}
}
+bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display)
+{
+ QWaylandShellIntegration::initialize(display);
+ return m_wlShell != nullptr;
+};
+
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
{
return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window);
diff --git a/src/client/qwaylandwlshellintegration_p.h b/src/client/qwaylandwlshellintegration_p.h
index 8531eb3a..9082c762 100644
--- a/src/client/qwaylandwlshellintegration_p.h
+++ b/src/client/qwaylandwlshellintegration_p.h
@@ -58,7 +58,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellI
{
public:
QWaylandWlShellIntegration(QWaylandDisplay* display);
- bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_wlShell != Q_NULLPTR; }
+ bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
private:
diff --git a/src/client/qwaylandxdgshellintegration.cpp b/src/client/qwaylandxdgshellintegration.cpp
index b6b1d9d3..a48157df 100644
--- a/src/client/qwaylandxdgshellintegration.cpp
+++ b/src/client/qwaylandxdgshellintegration.cpp
@@ -54,6 +54,12 @@ QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *displa
}
}
+bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
+{
+ QWaylandShellIntegration::initialize(display);
+ return m_xdgShell != nullptr;
+}
+
QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
{
if (window->window()->type() == Qt::WindowType::Popup)
@@ -62,6 +68,13 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi
return m_xdgShell->createXdgSurface(window);
}
+void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
+ if (newFocus && qobject_cast<QWaylandXdgPopup *>(newFocus->shellSurface()))
+ m_display->handleWindowActivated(newFocus);
+ if (oldFocus && qobject_cast<QWaylandXdgPopup *>(oldFocus->shellSurface()))
+ m_display->handleWindowDeactivated(oldFocus);
+}
+
}
QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgshellintegration_p.h b/src/client/qwaylandxdgshellintegration_p.h
index 29374ff1..e0e6bda0 100644
--- a/src/client/qwaylandxdgshellintegration_p.h
+++ b/src/client/qwaylandxdgshellintegration_p.h
@@ -59,8 +59,9 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShell
{
public:
QWaylandXdgShellIntegration(QWaylandDisplay *display);
- bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_xdgShell != Q_NULLPTR; }
+ bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
+ void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE;
private:
QWaylandXdgShell *m_xdgShell;
diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h
index 27decabb..1a5eeed7 100644
--- a/src/client/qwaylandxdgsurface_p.h
+++ b/src/client/qwaylandxdgsurface_p.h
@@ -96,8 +96,6 @@ 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; }
diff --git a/src/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h
index e8e46eca..144e5835 100644
--- a/src/client/shellintegration/qwaylandshellintegration_p.h
+++ b/src/client/shellintegration/qwaylandshellintegration_p.h
@@ -53,6 +53,7 @@
#include <QtCore/qglobal.h>
#include <QtWaylandClient/qwaylandclientexport.h>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
QT_BEGIN_NAMESPACE
@@ -68,8 +69,20 @@ public:
QWaylandShellIntegration() {}
virtual ~QWaylandShellIntegration() {}
- virtual bool initialize(QWaylandDisplay *display) = 0;
+ virtual bool initialize(QWaylandDisplay *display) {
+ m_display = display;
+ return true;
+ }
virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0;
+ virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
+ if (newFocus)
+ m_display->handleWindowActivated(newFocus);
+ if (oldFocus)
+ m_display->handleWindowDeactivated(oldFocus);
+ }
+
+protected:
+ QWaylandDisplay *m_display;
};
}
diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp
index 6876385b..6103e6be 100644
--- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp
+++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp
@@ -66,6 +66,7 @@ QWaylandIviShellIntegration::~QWaylandIviShellIntegration()
bool QWaylandIviShellIntegration::initialize(QWaylandDisplay *display)
{
+ QWaylandShellIntegration::initialize(display);
display->addRegistryListener(registryIvi, this);
return true;