diff options
author | David Redondo <qt@david-redondo.de> | 2023-02-23 10:39:01 +0100 |
---|---|---|
committer | David Redondo <qt@david-redondo.de> | 2023-03-01 11:06:23 +0100 |
commit | 42091fa8d180068f73b068b25724d1a251b7bb27 (patch) | |
tree | 11465e55e9451ea095f92a0dbcd9445eba0b4d05 /src/plugins | |
parent | e3306460dbe7d8ca2cbdacde11c1883b56d29b72 (diff) | |
download | qtwayland-42091fa8d180068f73b068b25724d1a251b7bb27.tar.gz |
Port wlshell integration to QWaylandShellIntegrationTemplate
Change-Id: Ib05a4645f930f41819447f6e1d562753a36e5710
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp | 19 | ||||
-rw-r--r-- | src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h | 8 |
2 files changed, 6 insertions, 21 deletions
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index f0e38a33..3a3e8b00 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -11,31 +11,16 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) +QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrationTemplate(1) { - const auto globals = display->globals(); - for (QWaylandDisplay::RegistryGlobal global : globals) { - if (global.interface == QLatin1String("wl_shell")) { - m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); - break; - } - } - - if (!m_wlShell) { - qCDebug(lcQpaWayland) << "Couldn't find global wl_shell"; - return false; - } - qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" << "\"xdg-shell\" if supported by the compositor" << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; - - return true; } QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { - return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->wlSurface()), window); + return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window); } void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 51dac4bc..fd3cb87f 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -23,16 +23,16 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration + : public QWaylandShellIntegrationTemplate<QWaylandWlShellIntegration>, + public QtWayland::wl_shell { public: - QWaylandWlShellIntegration() {} - bool initialize(QWaylandDisplay *) override; + QWaylandWlShellIntegration(); QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; private: - QtWayland::wl_shell *m_wlShell = nullptr; }; } |