1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qwaylandplatformservices_p.h"
5#include "qwaylandwindow_p.h"
6#include "qwaylanddisplay_p.h"
7#include "qwaylandshellsurface_p.h"
8#include "qwaylandwindowmanagerintegration_p.h"
9
10QT_BEGIN_NAMESPACE
11
12namespace QtWaylandClient {
13
14QWaylandPlatformServices::QWaylandPlatformServices(QWaylandDisplay *display)
15 : m_display(display) { }
16
17bool QWaylandPlatformServices::openUrl(const QUrl &url)
18{
19 if (auto windowManagerIntegration = m_display->windowManagerIntegration()) {
20 windowManagerIntegration->openUrl(url);
21 return true;
22 }
23 return QGenericUnixServices::openUrl(url);
24}
25
26bool QWaylandPlatformServices::openDocument(const QUrl &url)
27{
28 if (auto windowManagerIntegration = m_display->windowManagerIntegration()) {
29 windowManagerIntegration->openUrl(url);
30 return true;
31 }
32 return QGenericUnixServices::openDocument(url);
33}
34
35QString QWaylandPlatformServices::portalWindowIdentifier(QWindow *window)
36{
37 if (window && window->handle()) {
38 auto shellSurface = static_cast<QWaylandWindow *>(window->handle())->shellSurface();
39 if (shellSurface) {
40 const QString handle = shellSurface->externWindowHandle();
41 return QLatin1String("wayland:") + handle;
42 }
43 }
44 return QString();
45}
46} // namespace QtWaylandClient
47
48QT_END_NAMESPACE
49
50#include "moc_qwaylandplatformservices_p.cpp"
51

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtwayland/src/client/qwaylandplatformservices.cpp