Port fullscreenshell integration to QWaylandShellIntegrationTemplate

Change-Id: Ia3271a312d857d7e864444ad77e8e18a4a3858bf
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
David Redondo 2023-02-23 10:21:53 +01:00
parent 763229e8c0
commit 621a2d94ae
2 changed files with 13 additions and 19 deletions

View File

@ -8,26 +8,20 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient { 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) { QWaylandFullScreenShellV1Integration::~QWaylandFullScreenShellV1Integration()
qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell"; {
return false; if (isActive())
} release();
return true;
} }
QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window) QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window)
{ {
return new QWaylandFullScreenShellV1Surface(m_shell.data(), window); return new QWaylandFullScreenShellV1Surface(this, window);
} }
} // namespace QtWaylandClient } // namespace QtWaylandClient

View File

@ -14,14 +14,14 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient { namespace QtWaylandClient {
class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration
: public QWaylandShellIntegrationTemplate<QWaylandFullScreenShellV1Integration>,
public QtWayland::zwp_fullscreen_shell_v1
{ {
public: public:
bool initialize(QWaylandDisplay *display) override; QWaylandFullScreenShellV1Integration();
~QWaylandFullScreenShellV1Integration() override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
private:
QScopedPointer<QtWayland::zwp_fullscreen_shell_v1> m_shell;
}; };
} // namespace QtWaylandClient } // namespace QtWaylandClient