diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-11-22 13:37:10 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2016-12-06 08:42:44 +0000 |
commit | e2f856d9da896c202d98b179b9482fe7e7b57222 (patch) | |
tree | d9b79e62827a2eae39c819f8a963a7637a3e620c | |
parent | 542c6392ca52f86bd5fffb6141e93ad2a1ab8fcb (diff) |
Deprecate QT_WAYLAND_USE_XDG_SHELL
In favor of QT_WAYLAND_SHELL_INTEGRATION, which can be set to:
- ivi-shell
- wl-shell
- xdg-shell-v5
- xdg-shell-v6
Change-Id: Ie2ca1184f22dcac56beb441329ea8b5a9a81baf4
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | src/client/qwaylandintegration.cpp | 52 | ||||
-rw-r--r-- | src/client/qwaylandwlshellintegration.cpp | 7 | ||||
-rw-r--r-- | src/client/qwaylandwlshellintegration_p.h | 4 | ||||
-rw-r--r-- | src/client/qwaylandxdgshellintegration.cpp | 7 | ||||
-rw-r--r-- | src/client/qwaylandxdgshellintegration_p.h | 4 | ||||
-rw-r--r-- | src/client/qwaylandxdgshellv6integration.cpp | 7 | ||||
-rw-r--r-- | src/client/qwaylandxdgshellv6integration_p.h | 4 |
8 files changed, 64 insertions, 33 deletions
@@ -67,12 +67,11 @@ Shell Integration: Some platforms, especially non-desktop ones, use a custom Wayland shell extension. These are tailored to the specific embedded form factor better than the generic wl_shell or xdg_shell extensions that target desktop systems. +Custom shell protocols are added through shell integration plugins. -Instead of adding multiple protocol implementations into the QPA plugin, -a plugin architecture is used for selecting the shell integration; -when creating a shell surface, the protocol to use is taken from -the QT_WAYLAND_SHELL_INTEGRATION environment variable. If one is not provided or -not pointing to a valid plugin, wl_shell or xdg_shell will be used as fallbacks. +Which shell integration to use is determined by the QT_WAYLAND_SHELL_INTEGRATION +environment variable. If no shell is specified, the default is to first try +xdg-shell-v6 and then wl-shell. Example Usage: @@ -84,6 +83,9 @@ with ivi-shell integration: Available Shell Integrations: * ivi-shell + * wl-shell + * xdg-shell-v5 + * xdg-shell-v6 We hang out at #qt-labs and #qt-lighthouse on freenode if you have any questions diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 0dcd6b68f..f9ee61156 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -375,25 +375,25 @@ void QWaylandIntegration::initializeShellIntegration() QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); QString targetKey = QString::fromLocal8Bit(integrationName); + QStringList preferredShells; if (!targetKey.isEmpty()) { - QStringList keys = QWaylandShellIntegrationFactory::keys(); - if (keys.contains(targetKey)) { - qDebug("Using the '%s' shell integration", qPrintable(targetKey)); - mShellIntegration.reset(QWaylandShellIntegrationFactory::create(targetKey, QStringList())); - } + preferredShells << targetKey; } else { - QStringList preferredShells; - preferredShells << QLatin1String("zxdg_shell_v6"); - if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) - preferredShells << QLatin1String("xdg_shell"); - - preferredShells << QLatin1String("wl_shell"); - - Q_FOREACH (QString preferredShell, preferredShells) { - if (mDisplay->hasRegistryGlobal(preferredShell)) { - mShellIntegration.reset(createShellIntegration(preferredShell)); - break; - } + preferredShells << QLatin1String("xdg-shell-v6"); + QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL")); + if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) { + qWarning() << "QT_WAYLAND_USE_XDG_SHELL is deprecated, " + "please specify the shell using QT_WAYLAND_SHELL_INTEGRATION instead"; + preferredShells << QLatin1String("xdg-shell-v5"); + } + preferredShells << QLatin1String("wl-shell"); + } + + Q_FOREACH (QString preferredShell, preferredShells) { + mShellIntegration.reset(createShellIntegration(preferredShell)); + if (mShellIntegration) { + qDebug("Using the '%s' shell integration", qPrintable(preferredShell)); + break; } } @@ -429,16 +429,18 @@ void QWaylandIntegration::initializeInputDeviceIntegration() } } -QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &interfaceName) +QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) { - if (interfaceName == QLatin1Literal("wl_shell")) { - return new QWaylandWlShellIntegration(mDisplay.data()); - } else if (interfaceName == QLatin1Literal("xdg_shell")) { - return new QWaylandXdgShellIntegration(mDisplay.data()); - } else if (interfaceName == QLatin1Literal("zxdg_shell_v6")) { - return new QWaylandXdgShellV6Integration(mDisplay.data()); + if (integrationName == QLatin1Literal("wl-shell")) { + return QWaylandWlShellIntegration::create(mDisplay.data()); + } else if (integrationName == QLatin1Literal("xdg-shell-v5")) { + return QWaylandXdgShellIntegration::create(mDisplay.data()); + } else if (integrationName == QLatin1Literal("xdg-shell-v6")) { + return QWaylandXdgShellV6Integration::create(mDisplay.data()); + } else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { + return QWaylandShellIntegrationFactory::create(integrationName, QStringList()); } else { - return Q_NULLPTR; + return nullptr; } } diff --git a/src/client/qwaylandwlshellintegration.cpp b/src/client/qwaylandwlshellintegration.cpp index ce7c78346..8d61201bd 100644 --- a/src/client/qwaylandwlshellintegration.cpp +++ b/src/client/qwaylandwlshellintegration.cpp @@ -41,6 +41,13 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display) +{ + if (display->hasRegistryGlobal(QLatin1String("wl_shell"))) + return new QWaylandWlShellIntegration(display); + return nullptr; +} + QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) : m_wlShell(Q_NULLPTR) { diff --git a/src/client/qwaylandwlshellintegration_p.h b/src/client/qwaylandwlshellintegration_p.h index 9082c7628..393ccaf0a 100644 --- a/src/client/qwaylandwlshellintegration_p.h +++ b/src/client/qwaylandwlshellintegration_p.h @@ -57,11 +57,13 @@ namespace QtWaylandClient { class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration { public: - QWaylandWlShellIntegration(QWaylandDisplay* display); + static QWaylandWlShellIntegration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; private: + QWaylandWlShellIntegration(QWaylandDisplay* display); + QtWayland::wl_shell *m_wlShell; }; diff --git a/src/client/qwaylandxdgshellintegration.cpp b/src/client/qwaylandxdgshellintegration.cpp index a48157dfa..439dd4b15 100644 --- a/src/client/qwaylandxdgshellintegration.cpp +++ b/src/client/qwaylandxdgshellintegration.cpp @@ -43,6 +43,13 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { +QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay *display) +{ + if (display->hasRegistryGlobal(QLatin1String("xdg_shell"))) + return new QWaylandXdgShellIntegration(display); + return nullptr; +} + QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) : m_xdgShell(Q_NULLPTR) { diff --git a/src/client/qwaylandxdgshellintegration_p.h b/src/client/qwaylandxdgshellintegration_p.h index e0e6bda0d..0658e52b7 100644 --- a/src/client/qwaylandxdgshellintegration_p.h +++ b/src/client/qwaylandxdgshellintegration_p.h @@ -58,12 +58,14 @@ class QWaylandXdgShell; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration { public: - QWaylandXdgShellIntegration(QWaylandDisplay *display); + static QWaylandXdgShellIntegration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE; private: + QWaylandXdgShellIntegration(QWaylandDisplay *display); + QWaylandXdgShell *m_xdgShell; }; diff --git a/src/client/qwaylandxdgshellv6integration.cpp b/src/client/qwaylandxdgshellv6integration.cpp index 93f319875..26f50c376 100644 --- a/src/client/qwaylandxdgshellv6integration.cpp +++ b/src/client/qwaylandxdgshellv6integration.cpp @@ -55,6 +55,13 @@ QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *di } } +QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display) +{ + if (display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) + return new QWaylandXdgShellV6Integration(display); + return nullptr; +} + bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) { QWaylandShellIntegration::initialize(display); diff --git a/src/client/qwaylandxdgshellv6integration_p.h b/src/client/qwaylandxdgshellv6integration_p.h index 2e9cdac4f..21868c411 100644 --- a/src/client/qwaylandxdgshellv6integration_p.h +++ b/src/client/qwaylandxdgshellv6integration_p.h @@ -58,11 +58,13 @@ class QWaylandXdgShellV6; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration { public: - QWaylandXdgShellV6Integration(QWaylandDisplay *display); + static QWaylandXdgShellV6Integration *create(QWaylandDisplay* display); bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; private: + QWaylandXdgShellV6Integration(QWaylandDisplay *display); + QWaylandXdgShellV6 *m_xdgShell; }; |