KWaylandServer

subcompositor_interface.h
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3  SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7 
8 #pragma once
9 
10 #include <QObject>
11 
12 #include <KWaylandServer/kwaylandserver_export.h>
13 
14 struct wl_resource;
15 
16 namespace KWaylandServer
17 {
18 class Display;
19 class SubCompositorInterfacePrivate;
20 class SurfaceInterface;
21 class SubSurfaceInterface;
22 class SubSurfaceInterfacePrivate;
23 
24 /**
25  * The SubCompositorInterface compositor extension provides applications a way to offload
26  * compositing work within a window from clients to the compositor. This may reduce the power
27  * usage for applications such as video players, etc.
28  *
29  * The SubCompositorInterface corresponds to the Wayland interface @c wl_subcompositor.
30  */
31 class KWAYLANDSERVER_EXPORT SubCompositorInterface : public QObject
32 {
33  Q_OBJECT
34 
35 public:
36  explicit SubCompositorInterface(Display *display, QObject *parent = nullptr);
37  ~SubCompositorInterface() override;
38 
39 Q_SIGNALS:
40  /**
41  * This signal is emitted when a new sub-surface @subsurface has been created.
42  */
43  void subSurfaceCreated(KWaylandServer::SubSurfaceInterface *subsurface);
44 
45 private:
47 };
48 
49 /**
50  * The SubSurfaceInterface corresponds to the Wayland interface @c wl_subsurface.
51  */
52 class KWAYLANDSERVER_EXPORT SubSurfaceInterface : public QObject
53 {
54  Q_OBJECT
55 
56 public:
57  ~SubSurfaceInterface() override;
58 
59  /**
60  * Returns the position of the sub-surface relative to the upper-left corner of its parent.
61  */
62  QPoint position() const;
63 
64  /**
65  * This enum type is used to specify the commit behavior for a subsurface.
66  */
67  enum class Mode {
68  Synchronized,
69  Desynchronized,
70  };
71 
72  /**
73  * Returns the current commit mode.
74  *
75  * @see isSynchronized
76  */
77  Mode mode() const;
78 
79  /**
80  * Returns @c true if the sub-surface is in synchronized mode; otherwise returns @c false.
81  *
82  * This method checks whether this sub-surface or any of its ancestors is in the synchronized
83  * mode. Note that this function is not equivalent to calling mode() and checking whether
84  * the return value is Mode::Synchronized.
85  *
86  * @see mode
87  */
88  bool isSynchronized() const;
89 
90  /**
91  * Returns the SurfaceInterface for this SubSurfaceInterface. This function never returns a
92  * @c null.
93  */
94  SurfaceInterface *surface() const;
95 
96  /**
97  * Returns the parent surface for this SubSurfaceInterface. This function may return @c null.
98  */
99  SurfaceInterface *parentSurface() const;
100 
101  /**
102  * Returns the main surface for the sub-surface tree, that is the first surface without a parent
103  */
104  SurfaceInterface *mainSurface() const;
105 
106 Q_SIGNALS:
107  /**
108  * This signal is emitted when the position of the sub-surface has changed.
109  */
110  void positionChanged(const QPoint &position);
111  /**
112  * This signal is emitted when the commit mode of the sub-surface has changed.
113  */
114  void modeChanged(KWaylandServer::SubSurfaceInterface::Mode mode);
115 
116 private:
117  SubSurfaceInterface(SurfaceInterface *surface, SurfaceInterface *parent, wl_resource *resource);
119  friend class SubSurfaceInterfacePrivate;
120  friend class SubCompositorInterfacePrivate;
121 };
122 
123 } // namespace KWaylandServer
124 
Class holding the Wayland server display loop.
Definition: display.h:47
The SubSurfaceInterface corresponds to the Wayland interface wl_subsurface.
The SubCompositorInterface compositor extension provides applications a way to offload compositing wo...
Mode
This enum type is used to specify the commit behavior for a subsurface.
Resource representing a wl_surface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Oct 24 2021 23:08:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.