KWaylandServer

layershell_v1_interface.h
1 /*
2  SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #pragma once
8 
9 #include "display.h"
10 
11 #include <QMargins>
12 
13 namespace KWaylandServer
14 {
15 class LayerShellV1InterfacePrivate;
16 class LayerSurfaceV1Interface;
17 class LayerSurfaceV1InterfacePrivate;
18 class OutputInterface;
19 class SurfaceInterface;
20 
21 /**
22  * The LayerShellV1Interface compositor extension allows to create desktop shell surfaces.
23  *
24  * The layer shell compositor extension provides a way to create surfaces that can serve as
25  * building blocks for desktop environment elements such as panels, notifications, etc.
26  *
27  * The LayerShellV1Interface corresponds to the Wayland interface @c zwlr_layer_shell_v1.
28  */
29 class KWAYLANDSERVER_EXPORT LayerShellV1Interface : public QObject
30 {
31  Q_OBJECT
32 
33 public:
34  explicit LayerShellV1Interface(Display *display, QObject *parent = nullptr);
35  ~LayerShellV1Interface() override;
36 
37  /**
38  * Returns the Wayland display for the layer shell compositor extension.
39  */
40  Display *display() const;
41 
42 Q_SIGNALS:
43  /**
44  * This signal is emitted when a new layer surface @a surface has been created.
45  */
46  void surfaceCreated(LayerSurfaceV1Interface *surface);
47 
48 private:
50 };
51 
52 /**
53  * The LayerSurfaceV1Interface class represents a desktop shell surface, e.g. panel, etc.
54  *
55  * The LayerSurfaceV1Interface corresponds to the Wayland interface @c zwlr_layer_surface_v1.
56  */
57 class KWAYLANDSERVER_EXPORT LayerSurfaceV1Interface : public QObject
58 {
59  Q_OBJECT
60 
61 public:
62  enum Layer { BackgroundLayer, BottomLayer, TopLayer, OverlayLayer };
63 
65  SurfaceInterface *surface,
66  OutputInterface *output,
67  Layer layer,
68  const QString &scope,
69  wl_resource *resource);
70  ~LayerSurfaceV1Interface() override;
71 
72  /**
73  * Returns @c true if the initial commit has been performed; otherwise returns @c false.
74  */
75  bool isCommitted() const;
76 
77  /**
78  * Returns the underlying Wayland surface for this layer shell surface.
79  */
80  SurfaceInterface *surface() const;
81 
82  /**
83  * Returns the anchor point relative to which the surface will be positioned. If no edges
84  * have been specified, the center of the screen is assumed to be the anchor point.
85  */
86  Qt::Edges anchor() const;
87 
88  /**
89  * Returns the desired size for this layer shell surface, in the surface-local coordinates.
90  */
91  QSize desiredSize() const;
92 
93  /**
94  * Returns the stacking order layer where this layer surface has to be rendered.
95  */
96  Layer layer() const;
97 
98  /**
99  * Returns @c true if the surface accepts keyboard input; otherwise returns @c false.
100  */
101  bool acceptsFocus() const;
102 
103  /**
104  * Returns the margins object that indicates the distance between an anchor edge and
105  * the corresponding surface edge.
106  */
107  QMargins margins() const;
108 
109  /**
110  * Returns the value of the left margin. This is equivalent to calling margins().left().
111  */
112  int leftMargin() const;
113 
114  /**
115  * Returns the value of the right margin. This is equivalent to calling margins().right().
116  */
117  int rightMargin() const;
118 
119  /**
120  * Returns the value of the top margin. This is equivalent to calling margins().top().
121  */
122  int topMargin() const;
123 
124  /**
125  * Returns the value of the bottom margin. This is equivalent to calling margins().bottom().
126  */
127  int bottomMargin() const;
128 
129  /**
130  * Returns the distance from the anchor edge that should not be occluded.
131  *
132  * An exlusive zone of 0 means that the layer surface has to be moved to avoid occluding
133  * surfaces with a positive exclusion zone. If the exclusive zone is -1, the layer surface
134  * indicates that it doesn't want to be moved to accomodate for other surfaces.
135  */
136  int exclusiveZone() const;
137 
138  /**
139  * If the exclusive zone is positive, this function returns the corresponding exclusive
140  * anchor edge, otherwise returns a Qt::Edge() value.
141  */
142  Qt::Edge exclusiveEdge() const;
143 
144  /**
145  * Returns the output where the surface wants to be displayed. This function can return
146  * @c null, in which case the compositor is free to choose the output where the surface
147  * has to be placed.
148  */
149  OutputInterface *output() const;
150 
151  /**
152  * Returns the scope of this layer surface. The scope defines the purpose of the surface.
153  */
154  QString scope() const;
155 
156  /**
157  * Sends a configure event to the client. @a size contains the desired size in surface-local
158  * coordinates. A size of zero means that the client is free to choose its own dimensions.
159  *
160  * @see configureAcknowledged()
161  */
162  quint32 sendConfigure(const QSize &size);
163 
164  /**
165  * Sends a closed event to the client. The client should destroy the surface after receiving
166  * this event. Further changes to the surface will be ignored.
167  */
168  void sendClosed();
169 
170 Q_SIGNALS:
171  void aboutToBeDestroyed();
172  void configureAcknowledged(quint32 serial);
173  void acceptsFocusChanged();
174  void layerChanged();
175  void anchorChanged();
176  void desiredSizeChanged();
177  void exclusiveZoneChanged();
178  void marginsChanged();
179 
180 private:
182 };
183 
184 } // namespace KWaylandServer
The LayerSurfaceV1Interface class represents a desktop shell surface, e.g.
The OutputInterface class represents a screen.
typedef Edges
Class holding the Wayland server display loop.
Definition: display.h:47
The LayerShellV1Interface compositor extension allows to create desktop shell surfaces.
Resource representing a wl_surface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 23:08:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.