KWayland

server_decoration_interface.h
1 /*
2  SPDX-FileCopyrightText: 2015 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_SERVER_DECORATION_INTERFACE_H
7 #define KWAYLAND_SERVER_SERVER_DECORATION_INTERFACE_H
8 
9 #include "global.h"
10 #include "resource.h"
11 
12 #include <KWayland/Server/kwaylandserver_export.h>
13 
14 namespace KWayland
15 {
16 namespace Server
17 {
18 class Display;
19 class ServerSideDecorationInterface;
20 class SurfaceInterface;
21 
22 /**
23  * @brief Manager to create ServerSideDecorationInterface.
24  *
25  * @since 5.6
26  **/
27 class KWAYLANDSERVER_EXPORT ServerSideDecorationManagerInterface : public Global
28 {
29  Q_OBJECT
30 public:
32 
33  /**
34  * Decoration mode used for SurfaceInterfaces.
35  **/
36  enum class Mode {
37  /**
38  * Undecorated: neither client, nor server provide decoration. Example: popups.
39  **/
40  None,
41  /**
42  * The decoration is part of the surface.
43  **/
44  Client,
45  /**
46  * The surface gets embedded into a decoration frame provided by the Server.
47  **/
48  Server,
49  };
50 
51  /**
52  * Sets the default @p mode which is pushed to the Clients on creating a ServerSideDecorationInterface.
53  * @param mode The new default mode.
54  * @see defaultMode
55  **/
56  void setDefaultMode(Mode mode);
57  /**
58  * @returns the current default mode.
59  * @see setDefaultMode
60  **/
61  Mode defaultMode() const;
62 
63 Q_SIGNALS:
64  /**
65  * Emitted whenever a new ServerSideDecorationInterface is created.
66  **/
67  void decorationCreated(KWayland::Server::ServerSideDecorationInterface *);
68 
69 private:
70  explicit ServerSideDecorationManagerInterface(Display *display, QObject *parent = nullptr);
71  friend class Display;
72  class Private;
73  Private *d_func() const;
74 };
75 
76 /**
77  * @brief Representing how a SurfaceInterface should be decorated.
78  *
79  * Created by ServerSideDecorationManagerInterface and emitted with decorationCreated signal.
80  *
81  * @since 5.6
82  **/
83 class KWAYLANDSERVER_EXPORT ServerSideDecorationInterface : public Resource
84 {
85  Q_OBJECT
86 public:
88 
89  /**
90  * Sets the @p mode on the SurfaceInterface. A client might refuse the provided @p mode,
91  * in that case modeRequested will be emitted.
92  * @see mode
93  * @see modeRequested
94  **/
96  /**
97  * @returns the currently set mode, not the requested mode.
98  * @see setMode
99  * @see modeRequested
100  **/
102 
103  /**
104  * @returns The SurfaceInterface this ServerSideDecorationInterface references.
105  **/
106  SurfaceInterface *surface() const;
107 
108  /**
109  * @returns The ServerSideDecorationInterface for the given @p surface, @c nullptr if there is none.
110  **/
111  static ServerSideDecorationInterface *get(SurfaceInterface *surface);
112 
113 Q_SIGNALS:
114  /**
115  * The client requested the provided mode.
116  * The server needs to acknowledge the requested mode by setting it through setMode.
117  * @see setMode
118  * @see mode
119  **/
121 
122 private:
123  explicit ServerSideDecorationInterface(ServerSideDecorationManagerInterface *parent, SurfaceInterface *surface, wl_resource *parentResource);
125 
126  class Private;
127  Private *d_func() const;
128 };
129 
130 }
131 }
132 
135 
136 #endif
Representing how a SurfaceInterface should be decorated.
Manager to create ServerSideDecorationInterface.
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:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.