summaryrefslogtreecommitdiff
path: root/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp')
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
index 8d648b62..c7b757dd 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
@@ -1,6 +1,7 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qwaylandxdgshell_p.h"
#include "qwaylandxdgshellintegration_p.h"
#include "qwaylandxdgdecorationv1_p.h"
@@ -11,26 +12,38 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
+QWaylandXdgShellIntegration::QWaylandXdgShellIntegration() : QWaylandShellIntegrationTemplate(4)
{
- for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
- if (global.interface == QLatin1String("xdg_wm_base")) {
- m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version));
- break;
+ connect(this, &QWaylandShellIntegrationTemplate::activeChanged, this, [this] {
+ if (isActive()) {
+ mXdgShell.reset(new QWaylandXdgShell(mDisplay, this));
+ } else {
+ mXdgShell.reset(nullptr);
+ destroy();
}
- }
+ });
+}
- if (!m_xdgShell) {
- qCDebug(lcQpaWayland) << "Couldn't find global xdg_wm_base for xdg-shell stable";
- return false;
- }
+QWaylandXdgShellIntegration::~QWaylandXdgShellIntegration()
+{
+ if (isActive())
+ destroy();
+}
- return true;
+bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
+{
+ mDisplay = display;
+ return QWaylandShellIntegrationTemplate::initialize(display);
+}
+
+void QWaylandXdgShellIntegration::xdg_wm_base_ping(uint32_t serial)
+{
+ pong(serial);
}
QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
{
- return m_xdgShell->getXdgSurface(window);
+ return new QWaylandXdgSurface(mXdgShell.get(), get_xdg_surface(window->wlSurface()), window);
}
void *QWaylandXdgShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)