KWaylandServer

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 #pragma once
7 
8 #include <QObject>
9 
10 #include <KWaylandServer/kwaylandserver_export.h>
11 
12 struct wl_resource;
13 
14 namespace KWaylandServer
15 {
16 class Display;
17 class ServerSideDecorationInterface;
18 class SurfaceInterface;
19 class ServerSideDecorationManagerInterfacePrivate;
20 class ServerSideDecorationInterfacePrivate;
21 
22 /**
23  * @brief Manager to create ServerSideDecorationInterface.
24  */
25 class KWAYLANDSERVER_EXPORT ServerSideDecorationManagerInterface : public QObject
26 {
27  Q_OBJECT
28 
29 public:
30  explicit ServerSideDecorationManagerInterface(Display *display, QObject *parent = nullptr);
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(KWaylandServer::ServerSideDecorationInterface *);
68 
69 private:
71 };
72 
73 /**
74  * @brief Representing how a SurfaceInterface should be decorated.
75  *
76  * Created by ServerSideDecorationManagerInterface and emitted with decorationCreated signal.
77  */
78 class KWAYLANDSERVER_EXPORT ServerSideDecorationInterface : public QObject
79 {
80  Q_OBJECT
81 public:
83 
84  /**
85  * Sets the @p mode on the SurfaceInterface. A client might refuse the provided @p mode,
86  * in that case modeRequested will be emitted.
87  * @see mode
88  * @see modeRequested
89  */
91  /**
92  * @returns the currently set mode, not the requested mode.
93  * @see setMode
94  * @see modeRequested
95  */
97 
98  /**
99  * @returns The SurfaceInterface this ServerSideDecorationInterface references.
100  */
101  SurfaceInterface *surface() const;
102 
103  /**
104  * @returns The ServerSideDecorationInterface for the given @p surface, @c nullptr if there is none.
105  */
106  static ServerSideDecorationInterface *get(SurfaceInterface *surface);
107 
108 Q_SIGNALS:
109  /**
110  * The client requested the provided mode.
111  * The server needs to acknowledge the requested mode by setting it through setMode.
112  * @see setMode
113  * @see mode
114  */
116 
117 private:
118  explicit ServerSideDecorationInterface(SurfaceInterface *surface, wl_resource *resource);
119  friend class ServerSideDecorationManagerInterfacePrivate;
120 
122 };
123 
124 }
125 
Manager to create ServerSideDecorationInterface.
Class holding the Wayland server display loop.
Definition: display.h:47
Mode
Decoration mode used for SurfaceInterfaces.
Representing how a SurfaceInterface should be decorated.
Resource representing a wl_surface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:08:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.