File indexing completed on 2024-10-06 13:22:38

0001 /*
0002  *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
0004  *
0005  *   SPDX-License-Identifier: LGPL-3.0-or-later
0006  */
0007 
0008 #include "qwaylandlayershell_p.h"
0009 #include "qwaylandlayershellintegration_p.h"
0010 
0011 #include <QtWaylandClient/private/qwaylanddisplay_p.h>
0012 #include <QtWaylandClient/private/qwaylandwindow_p.h>
0013 #include <qwayland-wlr-layer-shell-unstable-v1.h>
0014 
0015 namespace LayerShellQt
0016 {
0017 QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
0018 {
0019 }
0020 
0021 QWaylandLayerShellIntegration::~QWaylandLayerShellIntegration()
0022 {
0023 }
0024 
0025 bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay *display)
0026 {
0027 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0028     QWaylandShellIntegration::initialize(display);
0029 #endif
0030     display->addRegistryListener(registryLayer, this);
0031     return m_layerShell != nullptr;
0032 }
0033 
0034 QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShellSurface(QtWaylandClient::QWaylandWindow *window)
0035 {
0036     return m_layerShell->createLayerSurface(window);
0037 }
0038 
0039 void QWaylandLayerShellIntegration::registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
0040 {
0041     QWaylandLayerShellIntegration *shell = static_cast<QWaylandLayerShellIntegration *>(data);
0042 
0043     if (interface == zwlr_layer_shell_v1_interface.name)
0044         shell->m_layerShell.reset(new QWaylandLayerShell(registry, id, std::min(version, 4u)));
0045 }
0046 
0047 }
0048 
0049 //#include "qwaylandlayershellintegration.moc"