KWayland

xdgshell_interface.h
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 #ifndef KWAYLAND_SERVER_XDGSHELL_INTERFACE_H
7 #define KWAYLAND_SERVER_XDGSHELL_INTERFACE_H
8 
9 #include "global.h"
10 #include "resource.h"
11 
12 #include <QSize>
13 
14 #include <KWayland/Server/kwaylandserver_export.h>
15 
16 namespace KWayland
17 {
18 namespace Server
19 {
20 
21 class OutputInterface;
22 class SeatInterface;
23 class SurfaceInterface;
24 class XdgShellPopupInterface;
25 class XdgShellSurfaceInterface;
26 template <typename T>
27 class GenericShellSurface;
28 
35 {
39  UnstableV5,
44  UnstableV6,
49  Stable
50 };
51 
60  SlideX = 1 << 0,
64  SlideY = 1 << 1,
68  FlipX = 1 << 2,
72  FlipY = 1 << 3,
76  ResizeX = 1 << 4,
80  ResizeY = 1 << 5
81 };
82 
84 
85 
89 class KWAYLANDSERVER_EXPORT XdgShellInterface : public Global
90 {
91  Q_OBJECT
92 public:
93  virtual ~XdgShellInterface();
94 
98  XdgShellInterfaceVersion interfaceVersion() const;
99 
103  //TODO KF6 make virtual
104  XdgShellSurfaceInterface *getSurface(wl_resource *native);
105 
114  quint32 ping(XdgShellSurfaceInterface * surface);
115 
116 Q_SIGNALS:
117  void surfaceCreated(KWayland::Server::XdgShellSurfaceInterface *surface);
118 
133  void popupCreated(KWayland::Server::XdgShellPopupInterface *surface, KWayland::Server::SeatInterface *seat, quint32 serial);
134 
135  /*
136  * Emitted whenever a new popup gets created.
137  *
138  * @param surface The popup xdg shell surface which got created
139  * @since 5.39
140  */
141  void xdgPopupCreated(KWayland::Server::XdgShellPopupInterface *surface);
142 
143  /*
144  * Emitted in response to a ping request
145  *
146  * @param serial unique identifier for the request
147  * @since 5.39
148  */
149  void pongReceived(quint32 serial);
150 
151  /*
152  * Emitted when the application takes more than expected
153  * to answer to a ping, this will always be emitted before
154  * eventuallt pingTimeout gets emitted
155  *
156  * @param serial unique identifier for the request
157  * @since 5.39
158  */
159  void pingDelayed(quint32 serial);
160 
161  /*
162  * Emitted when the application doesn't answer to a ping
163  * and the serve gave up on it
164  *
165  * @param serial unique identifier for the request
166  * @since 5.39
167  */
168  void pingTimeout(quint32 serial);
169 
170 protected:
171  class Private;
172  explicit XdgShellInterface(Private *d, QObject *parent = nullptr);
173 
174 private:
175  Private *d_func() const;
176 };
177 
178 
183 class KWAYLANDSERVER_EXPORT XdgShellSurfaceInterface : public Resource
184 {
185  Q_OBJECT
186 public:
187  virtual ~XdgShellSurfaceInterface();
188 
192  XdgShellInterfaceVersion interfaceVersion() const;
193 
197  enum class State {
201  Maximized = 1 << 0,
205  Fullscreen = 1 << 1,
209  Resizing = 1 << 2,
213  Activated = 1 << 3
214  };
215  Q_DECLARE_FLAGS(States, State)
216 
217 
230  quint32 configure(States states, const QSize &size = QSize(0, 0));
231 
237  bool isConfigurePending() const;
238 
242  SurfaceInterface *surface() const;
243 
248  QString title() const;
249  QByteArray windowClass() const;
250 
255  bool isTransient() const;
260  QPointer<XdgShellSurfaceInterface> transientFor() const;
261 
265  void close();
266 
274  QRect windowGeometry() const;
275 
280  QSize minimumSize() const;
281 
286  QSize maximumSize() const;
287 
288 Q_SIGNALS:
294  void titleChanged(const QString&);
300  void windowClassChanged(const QByteArray&);
307  void moveRequested(KWayland::Server::SeatInterface *seat, quint32 serial);
315  void resizeRequested(KWayland::Server::SeatInterface *seat, quint32 serial, Qt::Edges edges);
316  void windowMenuRequested(KWayland::Server::SeatInterface *seat, quint32 serial, const QPoint &surfacePos);
321  void maximizedChanged(bool maximized);
327  void fullscreenChanged(bool fullscreen, KWayland::Server::OutputInterface *output);
331  void minimizeRequested();
336  void configureAcknowledged(quint32 serial);
342  void transientForChanged();
343 
348  void maxSizeChanged(const QSize &size);
349 
354  void minSizeChanged(const QSize &size);
355 
361  void windowGeometryChanged(const QRect &windowGeometry);
362 
363 protected:
364  class Private;
365  explicit XdgShellSurfaceInterface(Private *p);
366 
367 private:
368  Private *d_func() const;
369  friend class GenericShellSurface<XdgShellSurfaceInterface>;
370 };
371 
376 class KWAYLANDSERVER_EXPORT XdgShellPopupInterface : public Resource
377 {
378  Q_OBJECT
379 public:
380  virtual ~XdgShellPopupInterface();
381 
385  SurfaceInterface *surface() const;
386 
387  /*
388  * Ask the popup surface to configure itself for the given configuration.
389  *
390  * @arg rect. The position of the surface relative to the transient parent
391  * @since 5.39
392  */
393  quint32 configure(const QRect &rect);
394 
399  QPointer<SurfaceInterface> transientFor() const;
400 
409  QPoint transientOffset() const;
410 
416  QSize initialSize() const;
417 
422  QRect anchorRect() const;
423 
428  Qt::Edges anchorEdge() const;
429 
435  QPoint anchorOffset() const;
436 
445  //DAVE left + right is illegal, so this is possible a useless return value? Maybe an enum with 9 entries left, topleft, top, ..
446  Qt::Edges gravity() const;
447 
452  PositionerConstraints constraintAdjustments() const;
453 
459  void popupDone();
460 
466  QRect windowGeometry()const;
467 
468 Q_SIGNALS:
475  void configureAcknowledged(quint32 serial);
476 
484  void grabRequested(KWayland::Server::SeatInterface *seat, quint32 serial);
485 
491  void windowGeometryChanged(const QRect &windowGeometry);
492 
493 protected:
494  class Private;
495  explicit XdgShellPopupInterface(Private *p);
496 
497 private:
498  friend class GenericShellSurface<XdgShellPopupInterface>;
499 
500  Private *d_func() const;
501 };
502 
503 }
504 }
505 
506 Q_DECLARE_METATYPE(KWayland::Server::XdgShellSurfaceInterface *)
507 Q_DECLARE_METATYPE(KWayland::Server::XdgShellPopupInterface *)
510 Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Server::PositionerConstraints)
511 
512 #endif
typedef Edges
Slide the popup on the Y axis until there is room.
Global for the wl_output interface.
Represents a Seat on the Wayland Display.
Invert the anchor and gravity on the Y axis.
Resource representing a wl_surface.
XdgShellInterfaceVersion
Enum describing the different InterfaceVersion encapsulated in this implementation.
Base class for all Globals.
Definition: global.h:46
Resize the popup in the Y axis.
Represents a bound Resource.
Definition: resource.h:32
Slide the popup on the X axis until there is room.
Invert the anchor and gravity on the X axis.
Resize the popup in the X axis.
PositionerConstraint
Flags describing how a popup should be reposition if constrained.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 3 2020 22:49:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.