summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandintegration.cpp
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-07-01 15:56:11 +0300
committerPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2014-08-07 07:59:00 +0200
commitd107e2ba88e44590f77c608073eee6429f3d3a8c (patch)
tree5b96804a31b04c8f17fff03907815f9a90fc24ab /src/client/qwaylandintegration.cpp
parent3419c5a868b6f528cfb17ee19261c937163ea7e0 (diff)
Add a way to have out of source shell integrations
Some platforms (especially non-desktop ones) may use a custom Wayland shell extension, more tailored to the form factor than the generic and desktoppy wl_shell or xdg_shell. Instead of stuffing N protocol implementations in the QPA plugin use a plugin architecture to allow them to live out of tree. When creating a shell surface the QT_WAYLAND_SHELL_INTEGRATION env variable will be checked, and if it points to a valid plugin that will be used to create the shell surface, falling back to wl_shell or xdg_shell if no plugin is specified. Change-Id: I05019174bb915199dd726f5fdcc0385ef846e8de Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> Reviewed-by: Philippe Coval <rzr@gna.org> Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/client/qwaylandintegration.cpp')
-rw-r--r--src/client/qwaylandintegration.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index 02b7e56c6..85300a130 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -72,6 +72,9 @@
#include "qwaylandserverbufferintegration_p.h"
#include "qwaylandserverbufferintegrationfactory_p.h"
+#include "qwaylandshellintegration_p.h"
+#include "qwaylandshellintegrationfactory_p.h"
+
QT_BEGIN_NAMESPACE
class GenericWaylandTheme: public QGenericUnixTheme
@@ -108,6 +111,7 @@ public:
QWaylandIntegration::QWaylandIntegration()
: mClientBufferIntegration(0)
+ , mShellIntegration(Q_NULLPTR)
, mFontDb(new QGenericUnixFontDatabase())
, mNativeInterface(new QWaylandNativeInterface(this))
#ifndef QT_NO_ACCESSIBILITY
@@ -117,6 +121,7 @@ QWaylandIntegration::QWaylandIntegration()
#endif
, mClientBufferIntegrationInitialized(false)
, mServerBufferIntegrationInitialized(false)
+ , mShellIntegrationInitialized(false)
{
mDisplay = new QWaylandDisplay(this);
mClipboard = new QWaylandClipboard(mDisplay);
@@ -260,6 +265,14 @@ QWaylandServerBufferIntegration *QWaylandIntegration::serverBufferIntegration()
return mServerBufferIntegration;
}
+QWaylandShellIntegration *QWaylandIntegration::shellIntegration() const
+{
+ if (!mShellIntegrationInitialized)
+ const_cast<QWaylandIntegration *>(this)->initializeShellIntegration();
+
+ return mShellIntegration;
+}
+
void QWaylandIntegration::initializeClientBufferIntegration()
{
mClientBufferIntegrationInitialized = true;
@@ -321,4 +334,28 @@ void QWaylandIntegration::initializeServerBufferIntegration()
qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey));
}
+void QWaylandIntegration::initializeShellIntegration()
+{
+ mShellIntegrationInitialized = true;
+
+ QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
+ QString targetKey = QString::fromLocal8Bit(integrationName);
+
+ if (targetKey.isEmpty()) {
+ return;
+ }
+
+ QStringList keys = QWaylandShellIntegrationFactory::keys();
+ if (keys.contains(targetKey)) {
+ mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList());
+ }
+ if (mShellIntegration && mShellIntegration->initialize(mDisplay)) {
+ qDebug("Using the '%s' shell integration", qPrintable(targetKey));
+ } else {
+ delete mShellIntegration;
+ mShellIntegration = Q_NULLPTR;
+ qWarning("Failed to load shell integration %s", qPrintable(targetKey));
+ }
+}
+
QT_END_NAMESPACE