KWaylandServer

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

KDE's Doxygen guidelines are available online.