KWayland

subcompositor_interface.h
1 /*
2  SPDX-FileCopyrightText: 2014 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 WAYLAND_SERVER_SUBCOMPOSITOR_INTERFACE_H
7 #define WAYLAND_SERVER_SUBCOMPOSITOR_INTERFACE_H
8 
9 #include <QObject>
10 #include <QPointer>
11 
12 #include <KWayland/Server/kwaylandserver_export.h>
13 
14 #include "global.h"
15 #include "resource.h"
16 
17 struct wl_resource;
18 
19 namespace KWayland
20 {
21 namespace Server
22 {
23 class Display;
24 class SurfaceInterface;
25 class SubSurfaceInterface;
26 
27 /**
28  * @todo Add documentation
29  */
30 class KWAYLANDSERVER_EXPORT SubCompositorInterface : public Global
31 {
32  Q_OBJECT
33 public:
34  virtual ~SubCompositorInterface();
35 
36 Q_SIGNALS:
37  void subSurfaceCreated(KWayland::Server::SubSurfaceInterface *);
38 
39 private:
40  explicit SubCompositorInterface(Display *display, QObject *parent = nullptr);
41  friend class Display;
42  class Private;
43 };
44 
45 /**
46  * @todo Add documentation
47  */
48 class KWAYLANDSERVER_EXPORT SubSurfaceInterface : public Resource
49 {
50  Q_OBJECT
51  Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
52  Q_PROPERTY(KWayland::Server::SubSurfaceInterface::Mode mode READ mode NOTIFY modeChanged)
53 public:
54  virtual ~SubSurfaceInterface();
55 
56  QPoint position() const;
57 
58  enum class Mode {
59  Synchronized,
60  Desynchronized,
61  };
62  Mode mode() const;
63 
64  /**
65  * Whether this SubSurfaceInterface is in synchronized mode.
66  * A SubSurface is in synchronized mode if either {@link mode} is
67  * @c Mode::Synchronized or if the parent surface is in synchronized
68  * mode. If a SubSurfaceInterface is in synchronized mode all child
69  * SubSurfaceInterfaces are also in synchronized mode ignoring the actual mode.
70  * @returns Whether this SubSurfaceInterface is in synchronized mode.
71  * @see mode
72  * @since 5.22
73  **/
74  bool isSynchronized() const;
75 
76  // TODO: remove with ABI break (KF6)
78  /**
79  * @returns The surface this SubSurfaceInterface was created on.
80  * @since 5.22
81  **/
82  QPointer<SurfaceInterface> surface() const;
83  // TODO: remove with ABI break (KF6)
84  QPointer<SurfaceInterface> parentSurface();
85  /**
86  * @returns The parent surface for which this SubSurfaceInterface is a child
87  * @since 5.22
88  **/
89  QPointer<SurfaceInterface> parentSurface() const;
90 
91  /**
92  * @returns the main surface for the sub-surface tree, that is the first surface without a parent
93  * @since 5.22
94  **/
95  QPointer<SurfaceInterface> mainSurface() const;
96 
97 Q_SIGNALS:
98  void positionChanged(const QPoint &);
99  void modeChanged(KWayland::Server::SubSurfaceInterface::Mode);
100 
101 private:
102  friend class SubCompositorInterface;
103  friend class SurfaceInterface;
104  explicit SubSurfaceInterface(SubCompositorInterface *parent, wl_resource *parentResource);
105 
106  class Private;
107  Private *d_func() const;
108 };
109 
110 }
111 }
112 
113 Q_DECLARE_METATYPE(KWayland::Server::SubSurfaceInterface::Mode)
114 
115 #endif
Resource representing a wl_surface.
Class holding the Wayland server display loop.
Definition: display.h:86
Base class for all Globals.
Definition: global.h:46
Represents a bound Resource.
Definition: resource.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:51:10 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.