1/*
2 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6#ifndef KWAYLAND_CLIENT_XDGSHELL_P_H
7#define KWAYLAND_CLIENT_XDGSHELL_P_H
8#include "xdgshell.h"
9
10#include <QDebug>
11#include <QRect>
12#include <QSize>
13
14namespace KWayland
15{
16namespace Client
17{
18class Q_DECL_HIDDEN XdgShell::Private
19{
20public:
21 virtual ~Private();
22 virtual void setupV5(xdg_shell *xdgshellv5)
23 {
24 Q_UNUSED(xdgshellv5)
25 }
26 virtual void setupV6(zxdg_shell_v6 *xdgshellv6)
27 {
28 Q_UNUSED(xdgshellv6)
29 }
30 virtual void setup(xdg_wm_base *xdgshell)
31 {
32 Q_UNUSED(xdgshell);
33 }
34 virtual void release() = 0;
35 virtual void destroy() = 0;
36 virtual bool isValid() const = 0;
37 virtual operator xdg_shell *()
38 {
39 return nullptr;
40 }
41 virtual operator xdg_shell *() const
42 {
43 return nullptr;
44 }
45 virtual operator zxdg_shell_v6 *()
46 {
47 return nullptr;
48 }
49 virtual operator zxdg_shell_v6 *() const
50 {
51 return nullptr;
52 }
53 virtual operator xdg_wm_base *()
54 {
55 return nullptr;
56 }
57 virtual operator xdg_wm_base *() const
58 {
59 return nullptr;
60 }
61
62 virtual XdgShellSurface *getXdgSurface(Surface *surface, QObject *parent) = 0;
63
64 virtual XdgShellPopup *getXdgPopup(Surface *surface, Surface *parentSurface, Seat *seat, quint32 serial, const QPoint &parentPos, QObject *parent)
65 {
66 Q_UNUSED(surface)
67 Q_UNUSED(parentSurface)
68 Q_UNUSED(seat)
69 Q_UNUSED(serial)
70 Q_UNUSED(parentPos)
71 Q_UNUSED(parent)
72 Q_ASSERT(false);
73 return nullptr;
74 };
75
76 virtual XdgShellPopup *getXdgPopup(Surface *surface, XdgShellSurface *parentSurface, const XdgPositioner &positioner, QObject *parent)
77 {
78 Q_UNUSED(surface)
79 Q_UNUSED(parentSurface)
80 Q_UNUSED(positioner)
81 Q_UNUSED(parent)
82 Q_ASSERT(false);
83 return nullptr;
84 }
85
86 virtual XdgShellPopup *getXdgPopup(Surface *surface, XdgShellPopup *parentSurface, const XdgPositioner &positioner, QObject *parent)
87 {
88 Q_UNUSED(surface)
89 Q_UNUSED(parentSurface)
90 Q_UNUSED(positioner)
91 Q_UNUSED(parent)
92 Q_ASSERT(false);
93 return nullptr;
94 }
95
96 EventQueue *queue = nullptr;
97
98protected:
99 Private() = default;
100};
101
102class XdgShellUnstableV5 : public XdgShell
103{
104 Q_OBJECT
105public:
106 explicit XdgShellUnstableV5(QObject *parent = nullptr);
107 ~XdgShellUnstableV5() override;
108
109private:
110 class Private;
111};
112
113class XdgShellUnstableV6 : public XdgShell
114{
115 Q_OBJECT
116public:
117 explicit XdgShellUnstableV6(QObject *parent = nullptr);
118 ~XdgShellUnstableV6() override;
119
120private:
121 class Private;
122};
123
124class XdgShellSurfaceUnstableV5 : public XdgShellSurface
125{
126 Q_OBJECT
127public:
128 ~XdgShellSurfaceUnstableV5() override;
129
130private:
131 explicit XdgShellSurfaceUnstableV5(QObject *parent = nullptr);
132 friend class XdgShellUnstableV5;
133 class Private;
134};
135
136class XdgTopLevelUnstableV6 : public XdgShellSurface
137{
138 Q_OBJECT
139public:
140 ~XdgTopLevelUnstableV6() override;
141
142private:
143 explicit XdgTopLevelUnstableV6(QObject *parent = nullptr);
144 friend class XdgShellUnstableV6;
145 class Private;
146};
147
148class Q_DECL_HIDDEN XdgShellSurface::Private
149{
150public:
151 virtual ~Private();
152 EventQueue *queue = nullptr;
153 QSize size;
154
155 virtual void setupV5(xdg_surface *surface)
156 {
157 Q_UNUSED(surface)
158 }
159 virtual void setupV6(zxdg_surface_v6 *surface, zxdg_toplevel_v6 *toplevel)
160 {
161 Q_UNUSED(toplevel)
162 Q_UNUSED(surface)
163 }
164 virtual void setup(xdg_surface *surface, xdg_toplevel *toplevel)
165 {
166 Q_UNUSED(surface)
167 Q_UNUSED(toplevel)
168 }
169 virtual void release() = 0;
170 virtual void destroy() = 0;
171 virtual bool isValid() const = 0;
172 virtual operator xdg_surface *()
173 {
174 return nullptr;
175 }
176 virtual operator xdg_surface *() const
177 {
178 return nullptr;
179 }
180 virtual operator xdg_toplevel *()
181 {
182 return nullptr;
183 }
184 virtual operator xdg_toplevel *() const
185 {
186 return nullptr;
187 }
188 virtual operator zxdg_surface_v6 *()
189 {
190 return nullptr;
191 }
192 virtual operator zxdg_surface_v6 *() const
193 {
194 return nullptr;
195 }
196 virtual operator zxdg_toplevel_v6 *()
197 {
198 return nullptr;
199 }
200 virtual operator zxdg_toplevel_v6 *() const
201 {
202 return nullptr;
203 }
204
205 virtual void setTransientFor(XdgShellSurface *parent) = 0;
206 virtual void setTitle(const QString &title) = 0;
207 virtual void setAppId(const QByteArray &appId) = 0;
208 virtual void showWindowMenu(Seat *seat, quint32 serial, qint32 x, qint32 y) = 0;
209 virtual void move(Seat *seat, quint32 serial) = 0;
210 virtual void resize(Seat *seat, quint32 serial, Qt::Edges edges) = 0;
211 virtual void ackConfigure(quint32 serial) = 0;
212 virtual void setMaximized() = 0;
213 virtual void unsetMaximized() = 0;
214 virtual void setFullscreen(Output *output) = 0;
215 virtual void unsetFullscreen() = 0;
216 virtual void setMinimized() = 0;
217 virtual void setMaxSize(const QSize &size) = 0;
218 virtual void setMinSize(const QSize &size) = 0;
219 virtual void setWindowGeometry(const QRect &windowGeometry)
220 {
221 Q_UNUSED(windowGeometry);
222 }
223
224protected:
225 Private(XdgShellSurface *q);
226
227 XdgShellSurface *q;
228};
229
230class Q_DECL_HIDDEN XdgShellPopup::Private
231{
232public:
233 Private(XdgShellPopup *q);
234 virtual ~Private();
235
236 EventQueue *queue = nullptr;
237
238 virtual void setupV5(xdg_popup *p)
239 {
240 Q_UNUSED(p)
241 }
242 virtual void setupV6(zxdg_surface_v6 *s, zxdg_popup_v6 *p)
243 {
244 Q_UNUSED(s)
245 Q_UNUSED(p)
246 }
247 virtual void setup(xdg_surface *s, xdg_popup *p)
248 {
249 Q_UNUSED(s)
250 Q_UNUSED(p)
251 }
252 virtual void release() = 0;
253 virtual void destroy() = 0;
254 virtual bool isValid() const = 0;
255 virtual void requestGrab(Seat *seat, quint32 serial)
256 {
257 Q_UNUSED(seat);
258 Q_UNUSED(serial);
259 };
260 virtual void ackConfigure(quint32 serial)
261 {
262 Q_UNUSED(serial);
263 }
264
265 virtual void setWindowGeometry(const QRect &windowGeometry)
266 {
267 Q_UNUSED(windowGeometry);
268 }
269
270 virtual operator xdg_surface *()
271 {
272 return nullptr;
273 }
274 virtual operator xdg_surface *() const
275 {
276 return nullptr;
277 }
278 virtual operator xdg_popup *()
279 {
280 return nullptr;
281 }
282 virtual operator xdg_popup *() const
283 {
284 return nullptr;
285 }
286 virtual operator zxdg_surface_v6 *()
287 {
288 return nullptr;
289 }
290 virtual operator zxdg_surface_v6 *() const
291 {
292 return nullptr;
293 }
294 virtual operator zxdg_popup_v6 *()
295 {
296 return nullptr;
297 }
298 virtual operator zxdg_popup_v6 *() const
299 {
300 return nullptr;
301 }
302
303protected:
304 XdgShellPopup *q;
305
306private:
307};
308
309class XdgPositioner::Private
310{
311public:
312 QSize initialSize;
313 QRect anchorRect;
314 Qt::Edges gravity;
315 Qt::Edges anchorEdge;
316 XdgPositioner::Constraints constraints;
317 QPoint anchorOffset;
318};
319
320class XdgShellPopupUnstableV5 : public XdgShellPopup
321{
322public:
323 ~XdgShellPopupUnstableV5() override;
324
325private:
326 explicit XdgShellPopupUnstableV5(QObject *parent = nullptr);
327 friend class XdgShellUnstableV5;
328 class Private;
329};
330
331class XdgShellPopupUnstableV6 : public XdgShellPopup
332{
333public:
334 ~XdgShellPopupUnstableV6() override;
335
336private:
337 explicit XdgShellPopupUnstableV6(QObject *parent = nullptr);
338 friend class XdgShellUnstableV6;
339 class Private;
340};
341
342}
343}
344
345#endif
346

source code of kwayland/src/client/xdgshell_p.h