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

KDE's Doxygen guidelines are available online.