| 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 "qwaylandwindowmanagerintegration_p.h" |
| 5 | #include "qwaylandscreen_p.h" |
| 6 | #include "qwaylandwindow_p.h" |
| 7 | #include "qwaylanddisplay_p.h" |
| 8 | #include "qwaylandshellsurface_p.h" |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include <QtCore/QEvent> |
| 12 | #include <QtCore/QHash> |
| 13 | #include <QtCore/QUrl> |
| 14 | #include <qpa/qplatformnativeinterface.h> |
| 15 | #include <qpa/qplatformwindow.h> |
| 16 | #include <QtGui/QtEvents> |
| 17 | #include <QtGui/QGuiApplication> |
| 18 | |
| 19 | #include <QDebug> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | namespace QtWaylandClient { |
| 24 | |
| 25 | QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay, |
| 26 | uint id, uint version) |
| 27 | : QtWayland::qt_windowmanager(waylandDisplay->object(), id, version) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() |
| 32 | { |
| 33 | qt_windowmanager_destroy(object()); |
| 34 | } |
| 35 | |
| 36 | bool QWaylandWindowManagerIntegration::showIsFullScreen() const |
| 37 | { |
| 38 | return m_showIsFullScreen; |
| 39 | } |
| 40 | |
| 41 | void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen) |
| 42 | { |
| 43 | m_showIsFullScreen = showIsFullScreen; |
| 44 | } |
| 45 | |
| 46 | void QWaylandWindowManagerIntegration::windowmanager_quit() |
| 47 | { |
| 48 | QGuiApplication::quit(); |
| 49 | } |
| 50 | |
| 51 | void QWaylandWindowManagerIntegration::openUrl(const QUrl &url) |
| 52 | { |
| 53 | QString data = url.toString(); |
| 54 | static const int chunkSize = 128; |
| 55 | while (!data.isEmpty()) { |
| 56 | QString chunk = data.left(n: chunkSize); |
| 57 | data = data.mid(position: chunkSize); |
| 58 | if (chunk.at(i: chunk.size() - 1).isHighSurrogate() && !data.isEmpty()) { |
| 59 | chunk.append(c: data.at(i: 0)); |
| 60 | data = data.mid(position: 1); |
| 61 | } |
| 62 | open_url(!data.isEmpty(), chunk); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | QT_END_NAMESPACE |
| 68 | |
| 69 | #include "moc_qwaylandwindowmanagerintegration_p.cpp" |
| 70 |
