| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <kde@broulik.de> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #include "helpers.h" |
| 8 | #include "waylandxdgforeignv2_p.h" |
| 9 | |
| 10 | WaylandXdgForeignExportedV2::WaylandXdgForeignExportedV2(::zxdg_exported_v2 *object) |
| 11 | : QObject() |
| 12 | , QtWayland::zxdg_exported_v2(object) |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | WaylandXdgForeignExportedV2::~WaylandXdgForeignExportedV2() |
| 17 | { |
| 18 | if (isQpaAlive()) { |
| 19 | destroy(); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | QString WaylandXdgForeignExportedV2::handle() const |
| 24 | { |
| 25 | return m_handle; |
| 26 | } |
| 27 | |
| 28 | void WaylandXdgForeignExportedV2::zxdg_exported_v2_handle(const QString &handle) |
| 29 | { |
| 30 | m_handle = handle; |
| 31 | Q_EMIT handleReceived(handle); |
| 32 | } |
| 33 | |
| 34 | WaylandXdgForeignExporterV2::WaylandXdgForeignExporterV2() |
| 35 | : QWaylandClientExtensionTemplate<WaylandXdgForeignExporterV2>(1) |
| 36 | { |
| 37 | initialize(); |
| 38 | } |
| 39 | |
| 40 | WaylandXdgForeignExporterV2::~WaylandXdgForeignExporterV2() |
| 41 | { |
| 42 | if (isQpaAlive() && isActive()) { |
| 43 | destroy(); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | WaylandXdgForeignExporterV2 &WaylandXdgForeignExporterV2::self() |
| 48 | { |
| 49 | static WaylandXdgForeignExporterV2 s_instance; |
| 50 | return s_instance; |
| 51 | } |
| 52 | |
| 53 | WaylandXdgForeignExportedV2 *WaylandXdgForeignExporterV2::exportToplevel(wl_surface *surface) |
| 54 | { |
| 55 | return new WaylandXdgForeignExportedV2(export_toplevel(surface)); |
| 56 | } |
| 57 | |
| 58 | WaylandXdgForeignImportedV2::WaylandXdgForeignImportedV2(const QString &handle, ::zxdg_imported_v2 *object) |
| 59 | : QObject() |
| 60 | , QtWayland::zxdg_imported_v2(object) |
| 61 | , m_handle(handle) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | WaylandXdgForeignImportedV2::~WaylandXdgForeignImportedV2() |
| 66 | { |
| 67 | if (isQpaAlive()) { |
| 68 | destroy(); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | void WaylandXdgForeignImportedV2::zxdg_imported_v2_destroyed() |
| 73 | { |
| 74 | delete this; |
| 75 | } |
| 76 | |
| 77 | QString WaylandXdgForeignImportedV2::handle() const |
| 78 | { |
| 79 | return m_handle; |
| 80 | } |
| 81 | |
| 82 | WaylandXdgForeignImporterV2::WaylandXdgForeignImporterV2() |
| 83 | : QWaylandClientExtensionTemplate<WaylandXdgForeignImporterV2>(1) |
| 84 | { |
| 85 | initialize(); |
| 86 | } |
| 87 | |
| 88 | WaylandXdgForeignImporterV2::~WaylandXdgForeignImporterV2() |
| 89 | { |
| 90 | if (isQpaAlive() && isActive()) { |
| 91 | destroy(); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | WaylandXdgForeignImporterV2 &WaylandXdgForeignImporterV2::self() |
| 96 | { |
| 97 | static WaylandXdgForeignImporterV2 s_instance; |
| 98 | return s_instance; |
| 99 | } |
| 100 | |
| 101 | WaylandXdgForeignImportedV2 *WaylandXdgForeignImporterV2::importToplevel(const QString &handle) |
| 102 | { |
| 103 | return new WaylandXdgForeignImportedV2(handle, import_toplevel(handle)); |
| 104 | } |
| 105 | |
| 106 | #include "moc_waylandxdgforeignv2_p.cpp" |
| 107 |
