summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandplatformservices.cpp
diff options
context:
space:
mode:
authorDavid Redondo <qt@david-redondo.de>2024-03-07 15:18:40 +0100
committerDavid Redondo <qt@david-redondo.de>2024-05-10 08:57:33 +0200
commitde2c3b3f85698d210ccfdb4b1e65e1c397a1cd3a (patch)
tree08b60b33367f0a4df03bc53e1ff9aab6d32c6a0c /src/client/qwaylandplatformservices.cpp
parenta5bea434aa9137f9b0ba6170fbb5a237e890b021 (diff)
client: Disentangle platform services and windowmanagerintegration
The current state was a bit messy with the platform services being the potentially no initialised qt window manager extension wayland object. Change-Id: Id1f911b75d34fcf70594ca7257b79bf431f0643f Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/client/qwaylandplatformservices.cpp')
-rw-r--r--src/client/qwaylandplatformservices.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/client/qwaylandplatformservices.cpp b/src/client/qwaylandplatformservices.cpp
new file mode 100644
index 000000000..14556d282
--- /dev/null
+++ b/src/client/qwaylandplatformservices.cpp
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 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 "qwaylandplatformservices_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylanddisplay_p.h"
+#include "qwaylandshellsurface_p.h"
+#include "qwaylandwindowmanagerintegration_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandPlatformServices::QWaylandPlatformServices(QWaylandDisplay *display)
+ : m_display(display) { }
+
+bool QWaylandPlatformServices::openUrl(const QUrl &url)
+{
+ if (auto windowManagerIntegration = m_display->windowManagerIntegration()) {
+ windowManagerIntegration->openUrl(url);
+ return true;
+ }
+ return QGenericUnixServices::openUrl(url);
+}
+
+bool QWaylandPlatformServices::openDocument(const QUrl &url)
+{
+ if (auto windowManagerIntegration = m_display->windowManagerIntegration()) {
+ windowManagerIntegration->openUrl(url);
+ return true;
+ }
+ return QGenericUnixServices::openDocument(url);
+}
+
+QString QWaylandPlatformServices::portalWindowIdentifier(QWindow *window)
+{
+ if (window && window->handle()) {
+ auto shellSurface = static_cast<QWaylandWindow *>(window->handle())->shellSurface();
+ if (shellSurface) {
+ const QString handle = shellSurface->externWindowHandle();
+ return QLatin1String("wayland:") + handle;
+ }
+ }
+ return QString();
+}
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandplatformservices_p.cpp"