KWin
Loading...
Searching...
No Matches
xdgforeign_v2_p.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2017 Marco Martin <notmart@gmail.com>
3 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
4 SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <kde@broulik.de>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8#pragma once
9
10#include "surface_p.h"
11#include "xdgforeign_v2.h"
12
13#include <qwayland-server-xdg-foreign-unstable-v2.h>
14
15#include <QPointer>
16
17namespace KWin
18{
19class XdgExportedV2Interface;
20class XdgImportedV2Interface;
21class XdgImporterV2Interface;
22class XdgExporterV2Interface;
23
25{
26public:
28
30 std::unique_ptr<XdgExporterV2Interface> exporter;
31 std::unique_ptr<XdgImporterV2Interface> importer;
32};
33
34class XdgExporterV2Interface : public QObject, public QtWaylandServer::zxdg_exporter_v2
35{
36 Q_OBJECT
37
38public:
40
41 XdgExportedSurface *exportedSurface(const QString &handle) const;
43
44protected:
45 void zxdg_exporter_v2_destroy(Resource *resource) override;
46 void zxdg_exporter_v2_export_toplevel(Resource *resource, uint32_t id, wl_resource *surface) override;
47
48private:
49 void addExported(XdgExportedSurface *exported);
50
51 QHash<QString, XdgExportedSurface *> m_exportedSurfaces;
52};
53
54class XdgImporterV2Interface : public QObject, public QtWaylandServer::zxdg_importer_v2
55{
56 Q_OBJECT
57
58public:
60
61 void link(XdgImportedV2Interface *parent, SurfaceInterface *child);
63
65
66protected:
67 void zxdg_importer_v2_destroy(Resource *resource) override;
68 void zxdg_importer_v2_import_toplevel(Resource *resource, uint32_t id, const QString &handle) override;
69
70private:
71 XdgForeignV2Interface *m_foreign;
72 QHash<SurfaceInterface *, XdgImportedV2Interface *> m_parents; // child->parent hash
73 QHash<XdgImportedV2Interface *, SurfaceInterface *> m_children; // parent->child hash
74};
75
76class XdgExportedV2Interface : public XdgExportedSurface, public QtWaylandServer::zxdg_exported_v2
77{
78 Q_OBJECT
79
80public:
81 explicit XdgExportedV2Interface(SurfaceInterface *surface, wl_resource *resource);
82
83protected:
84 void zxdg_exported_v2_destroy(Resource *resource) override;
85 void zxdg_exported_v2_destroy_resource(Resource *resource) override;
86};
87
88class XdgDummyImportedV2Interface : public QtWaylandServer::zxdg_imported_v2
89{
90public:
91 explicit XdgDummyImportedV2Interface(wl_resource *resource);
92
93protected:
94 void zxdg_imported_v2_destroy(Resource *resource) override;
95 void zxdg_imported_v2_destroy_resource(Resource *resource) override;
96};
97
98class XdgImportedV2Interface : public QObject, QtWaylandServer::zxdg_imported_v2
99{
100 Q_OBJECT
101public:
102 explicit XdgImportedV2Interface(XdgExportedSurface *exported, wl_resource *resource);
103
104 SurfaceInterface *child() const;
105 SurfaceInterface *surface() const;
106
107Q_SIGNALS:
109
110private Q_SLOTS:
111 void handleExportedDestroyed();
112
113private:
114 XdgExportedSurface *m_exported;
115 QPointer<SurfaceInterface> m_child;
116
117protected:
118 void zxdg_imported_v2_set_parent_of(Resource *resource, wl_resource *surface) override;
119 void zxdg_imported_v2_destroy(Resource *resource) override;
120 void zxdg_imported_v2_destroy_resource(Resource *resource) override;
121};
122}
Class holding the Wayland server display loop.
Definition display.h:34
Resource representing a wl_surface.
Definition surface.h:80
void zxdg_imported_v2_destroy(Resource *resource) override
void zxdg_imported_v2_destroy_resource(Resource *resource) override
XdgDummyImportedV2Interface(wl_resource *resource)
SurfaceInterface * surface() const
XdgExportedV2Interface(SurfaceInterface *surface, wl_resource *resource)
void zxdg_exported_v2_destroy_resource(Resource *resource) override
void zxdg_exported_v2_destroy(Resource *resource) override
void zxdg_exporter_v2_destroy(Resource *resource) override
XdgExportedSurface * exportSurface(SurfaceInterface *surface)
XdgExporterV2Interface(Display *display, XdgForeignV2Interface *foreign)
void zxdg_exporter_v2_export_toplevel(Resource *resource, uint32_t id, wl_resource *surface) override
XdgExportedSurface * exportedSurface(const QString &handle) const
std::unique_ptr< XdgExporterV2Interface > exporter
std::unique_ptr< XdgImporterV2Interface > importer
XdgForeignV2InterfacePrivate(Display *display, XdgForeignV2Interface *q)
void zxdg_imported_v2_destroy(Resource *resource) override
SurfaceInterface * surface() const
void zxdg_imported_v2_destroy_resource(Resource *resource) override
void zxdg_imported_v2_set_parent_of(Resource *resource, wl_resource *surface) override
void childChanged(KWin::SurfaceInterface *child)
SurfaceInterface * child() const
XdgImportedV2Interface(XdgExportedSurface *exported, wl_resource *resource)
void zxdg_importer_v2_import_toplevel(Resource *resource, uint32_t id, const QString &handle) override
void zxdg_importer_v2_destroy(Resource *resource) override
XdgImporterV2Interface(Display *display, XdgForeignV2Interface *foreign)
void link(XdgImportedV2Interface *parent, SurfaceInterface *child)
void unlink(XdgImportedV2Interface *parent, SurfaceInterface *child)
SurfaceInterface * transientFor(SurfaceInterface *surface)