mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-07-14 11:04:20 -04:00
Initial commit
This commit is contained in:
53
src/qwaylandlayershellintegration.cpp
Normal file
53
src/qwaylandlayershellintegration.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
||||
* SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include "qwaylandlayershellintegration_p.h"
|
||||
#include "qwaylandlayershell_p.h"
|
||||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration() :
|
||||
m_layerShell(Q_NULLPTR)
|
||||
{
|
||||
}
|
||||
|
||||
bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay *display)
|
||||
{
|
||||
QWaylandShellIntegration::initialize(display);
|
||||
display->addRegistryListener(registryLayer, this);
|
||||
return m_layerShell != nullptr;
|
||||
}
|
||||
|
||||
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::
|
||||
createShellSurface(QtWaylandClient::QWaylandWindow *window)
|
||||
{
|
||||
return m_layerShell->createLayerSurface(window);
|
||||
}
|
||||
|
||||
void QWaylandLayerShellIntegration::registryLayer(void *data,
|
||||
struct wl_registry *registry, uint32_t id,
|
||||
const QString &interface, uint32_t version)
|
||||
{
|
||||
QWaylandLayerShellIntegration *shell =
|
||||
static_cast<QWaylandLayerShellIntegration *>(data);
|
||||
|
||||
if (interface == QStringLiteral("zwlr_layer_shell_v1"))
|
||||
shell->m_layerShell = new QWaylandLayerShell(
|
||||
new QtWayland::zwlr_layer_shell_v1(registry, id, version));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
//#include "qwaylandlayershellintegration.moc"
|
Reference in New Issue
Block a user