KWayland

plasmavirtualdesktop_interface.h
1 /*
2  SPDX-FileCopyrightText: 2018 Marco Martin <[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_PLASMAVIRTUALDESKTOP_H
7 #define KWAYLAND_SERVER_PLASMAVIRTUALDESKTOP_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 PlasmaVirtualDesktopInterface;
20 
21 /**
22  * @short Wrapper for the org_kde_plasma_virtual_desktop_management interface.
23  *
24  * This class provides a convenient wrapper for the org_kde_plasma_virtual_desktop_management interface.
25  * @since 5.52
26  */
27 class KWAYLANDSERVER_EXPORT PlasmaVirtualDesktopManagementInterface : public Global
28 {
29  Q_OBJECT
30 public:
32 
33  /**
34  * Sets how many rows the virtual desktops should be laid into
35  * @since 5.55
36  */
37  void setRows(quint32 rows);
38 
39  /**
40  * @returns A desktop identified uniquely by this id.
41  * If not found, nullptr will be returned.
42  * @see createDesktop
43  */
44  PlasmaVirtualDesktopInterface *desktop(const QString &id);
45 
46  /**
47  * @returns A desktop identified uniquely by this id, if not found
48  * a new desktop will be created for this id at a given position.
49  * @param id the id for the desktop
50  * @param position the position the desktop will be in, if not provided,
51  * it will be appended at the end. If the desktop was already
52  * existing, position is ignored.
53  */
54  PlasmaVirtualDesktopInterface *createDesktop(const QString &id, quint32 position = std::numeric_limits<uint32_t>::max());
55 
56  /**
57  * Removed and destroys the desktop identified by id, if present
58  */
59  void removeDesktop(const QString &id);
60 
61  /**
62  * @returns All the desktops present.
63  */
65 
66  /**
67  * Inform the clients that all the properties have been sent, and
68  * their client-side representation is complete.
69  */
70  void sendDone();
71 
72 Q_SIGNALS:
73  /**
74  * A desktop has been activated
75  */
76  void desktopActivated(const QString &id);
77 
78  /**
79  * The client asked to remove a desktop, It's responsibility of the server
80  * deciding whether to remove it or not.
81  */
82  void desktopRemoveRequested(const QString &id);
83 
84  /**
85  * The client asked to create a desktop, It's responsibility of the server
86  * deciding whether to create it or not.
87  * @param name The desired user readable name
88  * @param position The desired position. Normalized, guaranteed to be in the range 0-count
89  */
90  void desktopCreateRequested(const QString &name, quint32 position);
91 
92 private:
93  explicit PlasmaVirtualDesktopManagementInterface(Display *display, QObject *parent = nullptr);
94  friend class Display;
95  class Private;
96  Private *d_func() const;
97 };
98 
99 class KWAYLANDSERVER_EXPORT PlasmaVirtualDesktopInterface : public QObject
100 {
101  Q_OBJECT
102 public:
103  virtual ~PlasmaVirtualDesktopInterface();
104 
105  /**
106  * @returns the unique id for this desktop.
107  * ids are set at creation time by PlasmaVirtualDesktopManagementInterface::createDesktop
108  * and can't be changed at runtime.
109  */
110  QString id() const;
111 
112  /**
113  * Sets a new name for this desktop
114  */
115  void setName(const QString &name);
116 
117  /**
118  * @returns the name for this desktop
119  */
120  QString name() const;
121 
122  /**
123  * Set this desktop as active or not.
124  * It's the compositor responsibility to manage the mutual exclusivity of active desktops.
125  */
126  void setActive(bool active);
127 
128  /**
129  * @returns true if this desktop is active. Only one at a time will be.
130  */
131  bool isActive() const;
132 
133  /**
134  * Inform the clients that all the properties have been sent, and
135  * their client-side representation is complete.
136  */
137  void sendDone();
138 
139 Q_SIGNALS:
140  /**
141  * Emitted when the client asked to activate this desktop:
142  * it's the decision of the server whether to perform the activation or not.
143  */
144  void activateRequested();
145 
146 private:
147  explicit PlasmaVirtualDesktopInterface(PlasmaVirtualDesktopManagementInterface *parent);
149 
150  class Private;
151  const QScopedPointer<Private> d;
152 };
153 
154 }
155 }
156 
157 #endif
Class holding the Wayland server display loop.
Definition: display.h:86
Base class for all Globals.
Definition: global.h:46
Wrapper for the org_kde_plasma_virtual_desktop_management interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:51:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.