summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-05-09 22:57:53 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-05-18 09:37:07 +0000
commit42f71e680c6146526fb18116b1b98995543443c0 (patch)
tree465f50e000788cd699f7cbf3425c9404abea4712
parent9ac2cdf96d36db9612effdbdb9669bd413b66b84 (diff)
Move wl-shell to a plugin
[ChangeLog][QPA plugin] The wl-shell shell integration has been moved to a plugin. This also adds API so shell integrations can return native resources for windows, as it was needed in order to continue to supporting wl_shell_surface. Change-Id: Ibc68ffcc5b0c6993d8f4e078f663e4d67340e1a5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/client/client.pro4
-rw-r--r--src/client/qwaylanddisplay.cpp1
-rw-r--r--src/client/qwaylanddisplay_p.h2
-rw-r--r--src/client/qwaylandintegration.cpp5
-rw-r--r--src/client/qwaylandnativeinterface.cpp15
-rw-r--r--src/client/qwaylandwindow.cpp1
-rw-r--r--src/client/shellintegration/qwaylandshellintegration_p.h5
-rw-r--r--src/plugins/shellintegration/shellintegration.pro4
-rw-r--r--src/plugins/shellintegration/wl-shell/main.cpp69
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp (renamed from src/client/qwaylandwlshellintegration.cpp)43
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h (renamed from src/client/qwaylandwlshellintegration_p.h)5
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp (renamed from src/client/qwaylandwlshellsurface.cpp)16
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h (renamed from src/client/qwaylandwlshellsurface_p.h)0
-rw-r--r--src/plugins/shellintegration/wl-shell/wl-shell.json3
-rw-r--r--src/plugins/shellintegration/wl-shell/wl-shell.pro23
15 files changed, 142 insertions, 54 deletions
diff --git a/src/client/client.pro b/src/client/client.pro
index 1bcd6780c..b14570046 100644
--- a/src/client/client.pro
+++ b/src/client/client.pro
@@ -42,8 +42,6 @@ SOURCES += qwaylandintegration.cpp \
qwaylandscreen.cpp \
qwaylandshmwindow.cpp \
qwaylandshellsurface.cpp \
- qwaylandwlshellsurface.cpp \
- qwaylandwlshellintegration.cpp \
qwaylandxdgshellv6.cpp \
qwaylandxdgshellv6integration.cpp \
qwaylandextendedsurface.cpp \
@@ -71,8 +69,6 @@ HEADERS += qwaylandintegration_p.h \
qwaylandbuffer_p.h \
qwaylandshmwindow_p.h \
qwaylandshellsurface_p.h \
- qwaylandwlshellsurface_p.h \
- qwaylandwlshellintegration_p.h \
qwaylandxdgshellv6_p.h \
qwaylandxdgshellv6integration_p.h \
qwaylandextendedsurface_p.h \
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 0199e169d..946e99bc8 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -51,7 +51,6 @@
#include "qwaylanddatadevicemanager_p.h"
#endif
#include "qwaylandhardwareintegration_p.h"
-#include "qwaylandwlshellsurface_p.h"
#include "qwaylandinputcontext_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 72f8444e0..d39e561f6 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -80,7 +80,7 @@ namespace QtWayland {
namespace QtWaylandClient {
-Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland);
+Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland);
class QWaylandInputDevice;
class QWaylandBuffer;
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index 2a169aca6..fbfdd57f4 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -77,7 +77,6 @@
#include "qwaylandshellintegration_p.h"
#include "qwaylandshellintegrationfactory_p.h"
-#include "qwaylandwlshellintegration_p.h"
#include "qwaylandxdgshellv6integration_p.h"
#include "qwaylandinputdeviceintegration_p.h"
@@ -442,9 +441,7 @@ void QWaylandIntegration::initializeInputDeviceIntegration()
QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName)
{
- if (integrationName == QLatin1Literal("wl-shell")) {
- return QWaylandWlShellIntegration::create(mDisplay.data());
- } else if (integrationName == QLatin1Literal("xdg-shell-v6")) {
+ if (integrationName == QLatin1Literal("xdg-shell-v6")) {
return QWaylandXdgShellV6Integration::create(mDisplay.data());
} else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) {
return QWaylandShellIntegrationFactory::create(integrationName, mDisplay.data());
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index 9946c3235..76acb526b 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -40,13 +40,13 @@
#include "qwaylandnativeinterface_p.h"
#include "qwaylanddisplay_p.h"
#include "qwaylandwindow_p.h"
+#include "qwaylandshellintegration_p.h"
#include "qwaylandsubsurface_p.h"
#include "qwaylandextendedsurface_p.h"
#include "qwaylandintegration_p.h"
#include "qwaylanddisplay_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandscreen_p.h"
-#include "qwaylandwlshellsurface_p.h"
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QScreen>
#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
@@ -91,18 +91,13 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
return w ? w->object() : nullptr;
}
- if (lowerCaseResource == "wl_shell_surface") {
- QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
- if (!w)
- return nullptr;
- QWaylandWlShellSurface *s = qobject_cast<QWaylandWlShellSurface *>(w->shellSurface());
- if (!s)
- return nullptr;
- return s->object();
- }
+
if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay);
+ if (auto shellIntegration = m_integration->shellIntegration())
+ return shellIntegration->nativeResourceForWindow(resourceString, window);
+
return nullptr;
}
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 45f9a19b2..ef49e8ea8 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -44,7 +44,6 @@
#include "qwaylandinputdevice_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandshellsurface_p.h"
-#include "qwaylandwlshellsurface_p.h"
#include "qwaylandsubsurface_p.h"
#include "qwaylandabstractdecoration_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
diff --git a/src/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h
index 7f3a2cefc..ccad00481 100644
--- a/src/client/shellintegration/qwaylandshellintegration_p.h
+++ b/src/client/shellintegration/qwaylandshellintegration_p.h
@@ -79,6 +79,11 @@ public:
if (oldFocus)
m_display->handleWindowDeactivated(oldFocus);
}
+ virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) {
+ Q_UNUSED(resource);
+ Q_UNUSED(window);
+ return nullptr;
+ }
protected:
QWaylandDisplay *m_display = nullptr;
diff --git a/src/plugins/shellintegration/shellintegration.pro b/src/plugins/shellintegration/shellintegration.pro
index 7f465d61b..12a900db2 100644
--- a/src/plugins/shellintegration/shellintegration.pro
+++ b/src/plugins/shellintegration/shellintegration.pro
@@ -2,4 +2,6 @@ TEMPLATE = subdirs
SUBDIRS += \
ivi-shell \
- xdg-shell-v5
+ xdg-shell-v5 \
+ wl-shell \
+
diff --git a/src/plugins/shellintegration/wl-shell/main.cpp b/src/plugins/shellintegration/wl-shell/main.cpp
new file mode 100644
index 000000000..9b033b5f3
--- /dev/null
+++ b/src/plugins/shellintegration/wl-shell/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandwlshellintegration_p.h"
+
+#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandWlShellIntegrationPlugin : public QWaylandShellIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "wl-shell.json")
+
+public:
+ QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override;
+};
+
+QWaylandShellIntegration *QWaylandWlShellIntegrationPlugin::create(const QString &key, const QStringList &paramList)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(paramList);
+ return new QWaylandWlShellIntegration();
+}
+
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/client/qwaylandwlshellintegration.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
index c76628420..be156dad2 100644
--- a/src/client/qwaylandwlshellintegration.cpp
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
@@ -38,29 +38,16 @@
****************************************************************************/
#include "qwaylandwlshellintegration_p.h"
+#include "qwaylandwlshellsurface_p.h"
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandwlshellsurface_p.h>
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display)
-{
- if (!display->hasRegistryGlobal(QLatin1String("wl_shell")))
- return nullptr;
-
- QScopedPointer<QWaylandWlShellIntegration> integration;
- integration.reset(new QWaylandWlShellIntegration(display));
- if (integration && !integration->initialize(display))
- return nullptr;
-
- return integration.take();
-}
-
-QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
+bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display)
{
Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) {
if (global.interface == QLatin1String("wl_shell")) {
@@ -68,19 +55,33 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
break;
}
}
-}
-bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display)
-{
- QWaylandShellIntegration::initialize(display);
- return m_wlShell != nullptr;
-};
+ if (!m_wlShell) {
+ qCDebug(lcQpaWayland) << "Couldn't find global wl_shell";
+ return false;
+ }
+
+ return QWaylandShellIntegration::initialize(display);
+}
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
{
return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window);
}
+void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
+{
+ QByteArray lowerCaseResource = resource.toLower();
+ if (lowerCaseResource == "wl_shell_surface") {
+ if (auto waylandWindow = static_cast<QWaylandWindow *>(window->handle())) {
+ if (auto shellSurface = qobject_cast<QWaylandWlShellSurface *>(waylandWindow->shellSurface())) {
+ return shellSurface->object();
+ }
+ }
+ }
+ return nullptr;
}
+} // namespace QtWaylandClient
+
QT_END_NAMESPACE
diff --git a/src/client/qwaylandwlshellintegration_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
index 7a6b53524..80a7507d4 100644
--- a/src/client/qwaylandwlshellintegration_p.h
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
@@ -63,13 +63,12 @@ namespace QtWaylandClient {
class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration
{
public:
- static QWaylandWlShellIntegration *create(QWaylandDisplay* display);
+ QWaylandWlShellIntegration() {}
bool initialize(QWaylandDisplay *) override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
+ void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
private:
- QWaylandWlShellIntegration(QWaylandDisplay* display);
-
QtWayland::wl_shell *m_wlShell = nullptr;
};
diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
index 3601fd437..9f2bcc00c 100644
--- a/src/client/qwaylandwlshellsurface.cpp
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
@@ -39,12 +39,12 @@
#include "qwaylandwlshellsurface_p.h"
-#include "qwaylanddisplay_p.h"
-#include "qwaylandwindow_p.h"
-#include "qwaylandinputdevice_p.h"
-#include "qwaylandabstractdecoration_p.h"
-#include "qwaylandscreen_p.h"
-#include "qwaylandextendedsurface_p.h"
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
+#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
+#include <QtWaylandClient/private/qwaylandscreen_p.h>
+#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
#include <QtCore/QDebug>
@@ -229,11 +229,11 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic
{
QWaylandWindow *parent_wayland_window = parent;
if (!parent_wayland_window) {
- qWarning("setPopup called without parent window");
+ qCWarning(lcQpaWayland) << "setPopup called without a parent window";
return;
}
if (!device) {
- qWarning("setPopup called without input device");
+ qCWarning(lcQpaWayland) << "setPopup called without an input device";
return;
}
diff --git a/src/client/qwaylandwlshellsurface_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h
index ca81dd685..ca81dd685 100644
--- a/src/client/qwaylandwlshellsurface_p.h
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h
diff --git a/src/plugins/shellintegration/wl-shell/wl-shell.json b/src/plugins/shellintegration/wl-shell/wl-shell.json
new file mode 100644
index 000000000..1859bb58a
--- /dev/null
+++ b/src/plugins/shellintegration/wl-shell/wl-shell.json
@@ -0,0 +1,3 @@
+{
+ "Keys":[ "wl-shell" ]
+}
diff --git a/src/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/shellintegration/wl-shell/wl-shell.pro
new file mode 100644
index 000000000..211dc876f
--- /dev/null
+++ b/src/plugins/shellintegration/wl-shell/wl-shell.pro
@@ -0,0 +1,23 @@
+QT += gui-private waylandclient-private
+CONFIG += wayland-scanner
+
+QMAKE_USE += wayland-client
+
+WAYLANDCLIENTSOURCES += \
+ ../../../3rdparty/protocol/wayland.xml
+
+HEADERS += \
+ qwaylandwlshellintegration_p.h \
+ qwaylandwlshellsurface_p.h \
+
+SOURCES += \
+ main.cpp \
+ qwaylandwlshellintegration.cpp \
+ qwaylandwlshellsurface.cpp \
+
+OTHER_FILES += \
+ wl-shell.json
+
+PLUGIN_TYPE = wayland-shell-integration
+PLUGIN_CLASS_NAME = QWaylandWlShellIntegrationPlugin
+load(qt_plugin)