KWayland

xdgshell.cpp
1 /*
2  SPDX-FileCopyrightText: 2016 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #include "../compat/wayland-xdg-shell-v5-client-protocol.h"
7 #include "event_queue.h"
8 #include "output.h"
9 #include "seat.h"
10 #include "surface.h"
11 #include "wayland_pointer_p.h"
12 #include "xdgshell_p.h"
13 
14 namespace KWayland
15 {
16 namespace Client
17 {
18 XdgShell::Private::~Private() = default;
19 
20 XdgShell::XdgShell(Private *p, QObject *parent)
21  : QObject(parent)
22  , d(p)
23 {
24 }
25 
26 XdgShell::~XdgShell()
27 {
28  release();
29 }
30 
31 void XdgShell::setup(xdg_shell *xdgshellv5)
32 {
33  d->setupV5(xdgshellv5);
34 }
35 
36 void XdgShell::setup(zxdg_shell_v6 *xdgshellv6)
37 {
38  d->setupV6(xdgshellv6);
39 }
40 
41 void XdgShell::setup(xdg_wm_base *xdg_wm_base)
42 {
43  d->setup(xdg_wm_base);
44 }
45 
46 void XdgShell::release()
47 {
48  d->release();
49 }
50 
51 void XdgShell::destroy()
52 {
53  d->destroy();
54 }
55 
56 void XdgShell::setEventQueue(EventQueue *queue)
57 {
58  d->queue = queue;
59 }
60 
61 EventQueue *XdgShell::eventQueue()
62 {
63  return d->queue;
64 }
65 
66 XdgShell::operator xdg_shell *()
67 {
68  return *(d.data());
69 }
70 
71 XdgShell::operator xdg_shell *() const
72 {
73  return *(d.data());
74 }
75 
76 XdgShell::operator zxdg_shell_v6 *()
77 {
78  return *(d.data());
79 }
80 
81 XdgShell::operator zxdg_shell_v6 *() const
82 {
83  return *(d.data());
84 }
85 
86 XdgShell::operator xdg_wm_base *()
87 {
88  return *(d.data());
89 }
90 
91 XdgShell::operator xdg_wm_base *() const
92 {
93  return *(d.data());
94 }
95 
96 bool XdgShell::isValid() const
97 {
98  return d->isValid();
99 }
100 
101 XdgShellSurface *XdgShell::createSurface(Surface *surface, QObject *parent)
102 {
103  return d->getXdgSurface(surface, parent);
104 }
105 
106 XdgShellPopup *XdgShell::createPopup(Surface *surface, Surface *parentSurface, Seat *seat, quint32 serial, const QPoint &parentPos, QObject *parent)
107 {
108  return d->getXdgPopup(surface, parentSurface, seat, serial, parentPos, parent);
109 }
110 
111 XdgShellPopup *XdgShell::createPopup(Surface *surface, XdgShellSurface *parentSurface, const XdgPositioner &positioner, QObject *parent)
112 {
113  return d->getXdgPopup(surface, parentSurface, positioner, parent);
114 }
115 
116 XdgShellPopup *XdgShell::createPopup(Surface *surface, XdgShellPopup *parentSurface, const XdgPositioner &positioner, QObject *parent)
117 {
118  return d->getXdgPopup(surface, parentSurface, positioner, parent);
119 }
120 
121 XdgShellSurface::Private::Private(XdgShellSurface *q)
122  : q(q)
123 {
124 }
125 
126 XdgShellSurface::Private::~Private() = default;
127 
128 XdgShellSurface::XdgShellSurface(Private *p, QObject *parent)
129  : QObject(parent)
130  , d(p)
131 {
132 }
133 
134 XdgShellSurface::~XdgShellSurface()
135 {
136  release();
137 }
138 
139 void XdgShellSurface::setup(xdg_surface *xdgsurfacev5)
140 {
141  d->setupV5(xdgsurfacev5);
142 }
143 
144 void XdgShellSurface::setup(zxdg_surface_v6 *xdgsurfacev6, zxdg_toplevel_v6 *xdgtoplevelv6)
145 {
146  d->setupV6(xdgsurfacev6, xdgtoplevelv6);
147 }
148 
149 void XdgShellSurface::setup(xdg_surface *xdgsurface, xdg_toplevel *xdgtoplevel)
150 {
151  d->setup(xdgsurface, xdgtoplevel);
152 }
153 
154 void XdgShellSurface::release()
155 {
156  d->release();
157 }
158 
159 void XdgShellSurface::destroy()
160 {
161  d->destroy();
162 }
163 
164 void XdgShellSurface::setEventQueue(EventQueue *queue)
165 {
166  d->queue = queue;
167 }
168 
169 EventQueue *XdgShellSurface::eventQueue()
170 {
171  return d->queue;
172 }
173 
174 XdgShellSurface::operator xdg_surface *()
175 {
176  return *(d.data());
177 }
178 
179 XdgShellSurface::operator xdg_surface *() const
180 {
181  return *(d.data());
182 }
183 
184 XdgShellSurface::operator xdg_toplevel *()
185 {
186  return *(d.data());
187 }
188 
189 XdgShellSurface::operator xdg_toplevel *() const
190 {
191  return *(d.data());
192 }
193 
194 XdgShellSurface::operator zxdg_surface_v6 *()
195 {
196  return *(d.data());
197 }
198 
199 XdgShellSurface::operator zxdg_surface_v6 *() const
200 {
201  return *(d.data());
202 }
203 
204 XdgShellSurface::operator zxdg_toplevel_v6 *()
205 {
206  return *(d.data());
207 }
208 
209 XdgShellSurface::operator zxdg_toplevel_v6 *() const
210 {
211  return *(d.data());
212 }
213 
214 bool XdgShellSurface::isValid() const
215 {
216  return d->isValid();
217 }
218 
219 void XdgShellSurface::setTransientFor(XdgShellSurface *parent)
220 {
221  d->setTransientFor(parent);
222 }
223 
224 void XdgShellSurface::setTitle(const QString &title)
225 {
226  d->setTitle(title);
227 }
228 
229 void XdgShellSurface::setAppId(const QByteArray &appId)
230 {
231  d->setAppId(appId);
232 }
233 
234 void XdgShellSurface::requestShowWindowMenu(Seat *seat, quint32 serial, const QPoint &pos)
235 {
236  d->showWindowMenu(seat, serial, pos.x(), pos.y());
237 }
238 
239 void XdgShellSurface::requestMove(Seat *seat, quint32 serial)
240 {
241  d->move(seat, serial);
242 }
243 
244 void XdgShellSurface::requestResize(Seat *seat, quint32 serial, Qt::Edges edges)
245 {
246  d->resize(seat, serial, edges);
247 }
248 
249 void XdgShellSurface::ackConfigure(quint32 serial)
250 {
251  d->ackConfigure(serial);
252 }
253 
254 void XdgShellSurface::setMaximized(bool set)
255 {
256  if (set) {
257  d->setMaximized();
258  } else {
259  d->unsetMaximized();
260  }
261 }
262 
263 void XdgShellSurface::setFullscreen(bool set, Output *output)
264 {
265  if (set) {
266  d->setFullscreen(output);
267  } else {
268  d->unsetFullscreen();
269  }
270 }
271 
272 void XdgShellSurface::setMaxSize(const QSize &size)
273 {
274  d->setMaxSize(size);
275 }
276 
277 void XdgShellSurface::setMinSize(const QSize &size)
278 {
279  d->setMinSize(size);
280 }
281 
282 void XdgShellSurface::setWindowGeometry(const QRect &windowGeometry)
283 {
284  d->setWindowGeometry(windowGeometry);
285 }
286 
287 void XdgShellSurface::requestMinimize()
288 {
289  d->setMinimized();
290 }
291 
292 void XdgShellSurface::setSize(const QSize &size)
293 {
294  if (d->size == size) {
295  return;
296  }
297  d->size = size;
298  Q_EMIT sizeChanged(size);
299 }
300 
301 QSize XdgShellSurface::size() const
302 {
303  return d->size;
304 }
305 
306 XdgShellPopup::Private::~Private() = default;
307 
308 XdgShellPopup::Private::Private(XdgShellPopup *q)
309  : q(q)
310 {
311 }
312 
313 XdgShellPopup::XdgShellPopup(Private *p, QObject *parent)
314  : QObject(parent)
315  , d(p)
316 {
317 }
318 
319 XdgShellPopup::~XdgShellPopup()
320 {
321  release();
322 }
323 
324 void XdgShellPopup::setup(xdg_popup *xdgpopupv5)
325 {
326  d->setupV5(xdgpopupv5);
327 }
328 
329 void XdgShellPopup::setup(zxdg_surface_v6 *xdgsurfacev6, zxdg_popup_v6 *xdgpopupv6)
330 {
331  d->setupV6(xdgsurfacev6, xdgpopupv6);
332 }
333 
334 void XdgShellPopup::setup(xdg_surface *surface, xdg_popup *popup)
335 {
336  d->setup(surface, popup);
337 }
338 
339 void XdgShellPopup::release()
340 {
341  d->release();
342 }
343 
344 void XdgShellPopup::destroy()
345 {
346  d->destroy();
347 }
348 
349 void XdgShellPopup::setEventQueue(EventQueue *queue)
350 {
351  d->queue = queue;
352 }
353 
354 EventQueue *XdgShellPopup::eventQueue()
355 {
356  return d->queue;
357 }
358 
359 void XdgShellPopup::requestGrab(KWayland::Client::Seat *seat, quint32 serial)
360 {
361  d->requestGrab(seat, serial);
362 }
363 
364 void XdgShellPopup::ackConfigure(quint32 serial)
365 {
366  d->ackConfigure(serial);
367 }
368 
369 void XdgShellPopup::setWindowGeometry(const QRect &windowGeometry)
370 {
371  d->setWindowGeometry(windowGeometry);
372 }
373 
374 XdgShellPopup::operator xdg_surface *()
375 {
376  return *(d.data());
377 }
378 
379 XdgShellPopup::operator xdg_surface *() const
380 {
381  return *(d.data());
382 }
383 
384 XdgShellPopup::operator xdg_popup *()
385 {
386  return *(d.data());
387 }
388 
389 XdgShellPopup::operator xdg_popup *() const
390 {
391  return *(d.data());
392 }
393 
394 XdgShellPopup::operator zxdg_surface_v6 *()
395 {
396  return *(d.data());
397 }
398 
399 XdgShellPopup::operator zxdg_surface_v6 *() const
400 {
401  return *(d.data());
402 }
403 
404 XdgShellPopup::operator zxdg_popup_v6 *()
405 {
406  return *(d.data());
407 }
408 
409 XdgShellPopup::operator zxdg_popup_v6 *() const
410 {
411  return *(d.data());
412 }
413 
414 bool XdgShellPopup::isValid() const
415 {
416  return d->isValid();
417 }
418 
419 XdgPositioner::XdgPositioner(const QSize &initialSize, const QRect &anchor)
420  : d(new Private)
421 {
422  d->initialSize = initialSize;
423  d->anchorRect = anchor;
424 }
425 
426 XdgPositioner::XdgPositioner(const XdgPositioner &other)
427  : d(new Private)
428 {
429  *d = *other.d;
430 }
431 
432 XdgPositioner::~XdgPositioner()
433 {
434 }
435 
436 void XdgPositioner::setInitialSize(const QSize &size)
437 {
438  d->initialSize = size;
439 }
440 
441 QSize XdgPositioner::initialSize() const
442 {
443  return d->initialSize;
444 }
445 
446 void XdgPositioner::setAnchorRect(const QRect &anchor)
447 {
448  d->anchorRect = anchor;
449 }
450 
451 QRect XdgPositioner::anchorRect() const
452 {
453  return d->anchorRect;
454 }
455 
456 void XdgPositioner::setAnchorEdge(Qt::Edges edge)
457 {
458  d->anchorEdge = edge;
459 }
460 
461 Qt::Edges XdgPositioner::anchorEdge() const
462 {
463  return d->anchorEdge;
464 }
465 
466 void XdgPositioner::setAnchorOffset(const QPoint &offset)
467 {
468  d->anchorOffset = offset;
469 }
470 
471 QPoint XdgPositioner::anchorOffset() const
472 {
473  return d->anchorOffset;
474 }
475 
476 void XdgPositioner::setGravity(Qt::Edges edge)
477 {
478  d->gravity = edge;
479 }
480 
481 Qt::Edges XdgPositioner::gravity() const
482 {
483  return d->gravity;
484 }
485 
486 void XdgPositioner::setConstraints(Constraints constraints)
487 {
488  d->constraints = constraints;
489 }
490 
491 XdgPositioner::Constraints XdgPositioner::constraints() const
492 {
493  return d->constraints;
494 }
495 
496 }
497 }
Builder class describing how a popup should be positioned when created.
Definition: xdgshell.h:44
typedef Edges
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:54
A XdgShellPopup is a short-lived, temporary surface that can be used to implement menus...
Definition: xdgshell.h:511
Wrapper for the wl_seat interface.
Definition: seat.h:51
Wrapper for the wl_output interface.
Definition: output.h:54
int x() const const
int y() const const
Wrapper for the wl_surface interface.
Definition: surface.h:43
T * data() const const
QObject(QObject *parent)
QObject * parent() const const
Q_EMITQ_EMIT
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:51:11 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.