File indexing completed on 2024-05-12 04:00:24
0001 /* 0002 SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <kde@broulik.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "waylandxdgforeignv2_p.h" 0008 0009 #include <QGuiApplication> 0010 0011 WaylandXdgForeignExportedV2::WaylandXdgForeignExportedV2(::zxdg_exported_v2 *object) 0012 : QObject() 0013 , QtWayland::zxdg_exported_v2(object) 0014 { 0015 } 0016 0017 WaylandXdgForeignExportedV2::~WaylandXdgForeignExportedV2() 0018 { 0019 if (qGuiApp) { 0020 destroy(); 0021 } 0022 } 0023 0024 QString WaylandXdgForeignExportedV2::handle() const 0025 { 0026 return m_handle; 0027 } 0028 0029 void WaylandXdgForeignExportedV2::zxdg_exported_v2_handle(const QString &handle) 0030 { 0031 m_handle = handle; 0032 Q_EMIT handleReceived(handle); 0033 } 0034 0035 WaylandXdgForeignExporterV2::WaylandXdgForeignExporterV2() 0036 : QWaylandClientExtensionTemplate<WaylandXdgForeignExporterV2>(1) 0037 { 0038 initialize(); 0039 } 0040 0041 WaylandXdgForeignExporterV2::~WaylandXdgForeignExporterV2() 0042 { 0043 if (qGuiApp && isActive()) { 0044 destroy(); 0045 } 0046 } 0047 0048 WaylandXdgForeignExporterV2 &WaylandXdgForeignExporterV2::self() 0049 { 0050 static WaylandXdgForeignExporterV2 s_instance; 0051 return s_instance; 0052 } 0053 0054 WaylandXdgForeignExportedV2 *WaylandXdgForeignExporterV2::exportToplevel(wl_surface *surface) 0055 { 0056 return new WaylandXdgForeignExportedV2(export_toplevel(surface)); 0057 } 0058 0059 WaylandXdgForeignImportedV2::WaylandXdgForeignImportedV2(const QString &handle, ::zxdg_imported_v2 *object) 0060 : QObject() 0061 , QtWayland::zxdg_imported_v2(object) 0062 , m_handle(handle) 0063 { 0064 } 0065 0066 WaylandXdgForeignImportedV2::~WaylandXdgForeignImportedV2() 0067 { 0068 if (qGuiApp) { 0069 destroy(); 0070 } 0071 } 0072 0073 void WaylandXdgForeignImportedV2::zxdg_imported_v2_destroyed() 0074 { 0075 delete this; 0076 } 0077 0078 QString WaylandXdgForeignImportedV2::handle() const 0079 { 0080 return m_handle; 0081 } 0082 0083 WaylandXdgForeignImporterV2::WaylandXdgForeignImporterV2() 0084 : QWaylandClientExtensionTemplate<WaylandXdgForeignImporterV2>(1) 0085 { 0086 initialize(); 0087 } 0088 0089 WaylandXdgForeignImporterV2::~WaylandXdgForeignImporterV2() 0090 { 0091 if (qGuiApp && isActive()) { 0092 destroy(); 0093 } 0094 } 0095 0096 WaylandXdgForeignImporterV2 &WaylandXdgForeignImporterV2::self() 0097 { 0098 static WaylandXdgForeignImporterV2 s_instance; 0099 return s_instance; 0100 } 0101 0102 WaylandXdgForeignImportedV2 *WaylandXdgForeignImporterV2::importToplevel(const QString &handle) 0103 { 0104 return new WaylandXdgForeignImportedV2(handle, import_toplevel(handle)); 0105 }