File indexing completed on 2024-05-05 04:45:45

0001 /*
0002  * SPDX-License-Identifier: LGPL-2.0-or-later
0003  *
0004  * SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QPointer>
0010 #include <QWaylandClientExtensionTemplate>
0011 #include "qwayland-xdg-foreign-unstable-v2.h"
0012 #include <optional>
0013 
0014 class QWindow;
0015 class XdgExporterV2;
0016 
0017 class XdgExportedV2 : public QObject, public QtWayland::zxdg_exported_v2
0018 {
0019 public:
0020     XdgExportedV2(XdgExporterV2* exporter);
0021     ~XdgExportedV2();
0022 
0023     std::optional<QString> handle() const;
0024     void setWindow(QWindow *window);
0025 
0026 private:
0027     void zxdg_exported_v2_handle(const QString &handle) override {
0028         m_handle = handle;
0029     }
0030     void useWindow(QWindow *window);
0031 
0032     std::optional<QString> m_handle;
0033     XdgExporterV2 *const m_exporter;
0034 };
0035 
0036 class XdgExporterV2 : public QWaylandClientExtensionTemplate<XdgExporterV2>, public QtWayland::zxdg_exporter_v2
0037 {
0038 public:
0039     XdgExporterV2();
0040     ~XdgExporterV2();
0041 
0042     XdgExportedV2 *exportWindow(QWindow *window);
0043     XdgExportedV2 *exportWidget(QWidget *widget);
0044 };