From 621a2d94aee3bd0d93bb26090ebf28a4c9ed1a82 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 23 Feb 2023 10:21:53 +0100 Subject: [PATCH] Port fullscreenshell integration to QWaylandShellIntegrationTemplate Change-Id: Ia3271a312d857d7e864444ad77e8e18a4a3858bf Reviewed-by: David Edmundson --- .../qwaylandfullscreenshellv1integration.cpp | 22 +++++++------------ .../qwaylandfullscreenshellv1integration.h | 10 ++++----- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp index ddac7d29505..7dcdd6e5997 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp @@ -8,26 +8,20 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandFullScreenShellV1Integration::initialize(QWaylandDisplay *display) +QWaylandFullScreenShellV1Integration::QWaylandFullScreenShellV1Integration() + : QWaylandShellIntegrationTemplate(1) { - for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) { - if (global.interface == QLatin1String("zwp_fullscreen_shell_v1") && !m_shell) { - m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, global.version)); - break; - } - } +} - if (!m_shell) { - qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell"; - return false; - } - - return true; +QWaylandFullScreenShellV1Integration::~QWaylandFullScreenShellV1Integration() +{ + if (isActive()) + release(); } QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window) { - return new QWaylandFullScreenShellV1Surface(m_shell.data(), window); + return new QWaylandFullScreenShellV1Surface(this, window); } } // namespace QtWaylandClient diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h index 48cb80c7355..c01af37074a 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h @@ -14,14 +14,14 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration + : public QWaylandShellIntegrationTemplate, + public QtWayland::zwp_fullscreen_shell_v1 { public: - bool initialize(QWaylandDisplay *display) override; + QWaylandFullScreenShellV1Integration(); + ~QWaylandFullScreenShellV1Integration() override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; - -private: - QScopedPointer m_shell; }; } // namespace QtWaylandClient