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