Changeset View
Changeset View
Standalone View
Standalone View
dbusinterface.h
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | #include <QtDBus> | 25 | #include <QtDBus> | ||
26 | 26 | | |||
27 | namespace KWin | 27 | namespace KWin | ||
28 | { | 28 | { | ||
29 | 29 | | |||
30 | class Compositor; | 30 | class Compositor; | ||
31 | class VirtualDesktopManager; | ||||
31 | 32 | | |||
32 | /** | 33 | /** | ||
33 | * @brief This class is a wrapper for the org.kde.KWin D-Bus interface. | 34 | * @brief This class is a wrapper for the org.kde.KWin D-Bus interface. | ||
34 | * | 35 | * | ||
35 | * The main purpose of this class is to be exported on the D-Bus as object /KWin. | 36 | * The main purpose of this class is to be exported on the D-Bus as object /KWin. | ||
36 | * It is a pure wrapper to provide the deprecated D-Bus methods which have been | 37 | * It is a pure wrapper to provide the deprecated D-Bus methods which have been | ||
37 | * removed from Workspace which used to implement the complete D-Bus interface. | 38 | * removed from Workspace which used to implement the complete D-Bus interface. | ||
38 | * | 39 | * | ||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | |||||
164 | 165 | | |||
165 | Q_SIGNALS: | 166 | Q_SIGNALS: | ||
166 | void compositingToggled(bool active); | 167 | void compositingToggled(bool active); | ||
167 | 168 | | |||
168 | private: | 169 | private: | ||
169 | Compositor *m_compositor; | 170 | Compositor *m_compositor; | ||
170 | }; | 171 | }; | ||
171 | 172 | | |||
173 | //TODO: disable all of this in case of kiosk? | ||||
174 | | ||||
175 | struct DBusDesktopDataStruct { | ||||
176 | uint x11DesktopNumber; | ||||
177 | QString id; | ||||
178 | QString name; | ||||
179 | }; | ||||
180 | typedef QVector<DBusDesktopDataStruct> DBusDesktopDataVector; | ||||
181 | | ||||
182 | class VirtualDesktopManagerDBusInterface : public QObject | ||||
183 | { | ||||
184 | Q_OBJECT | ||||
185 | Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.VirtualDesktopManager") | ||||
186 | | ||||
187 | /** | ||||
188 | * The number of virtual desktops currently available. | ||||
189 | * The ids of the virtual desktops are in the range [1, VirtualDesktopManager::maximum()]. | ||||
190 | **/ | ||||
191 | Q_PROPERTY(uint count READ count NOTIFY countChanged) | ||||
192 | /** | ||||
193 | * The number of rows the virtual desktops will be laid out in | ||||
194 | **/ | ||||
195 | Q_PROPERTY(uint rows READ rows WRITE setRows NOTIFY rowsChanged) | ||||
196 | /** | ||||
197 | * The id of the virtual desktop which is currently in use. | ||||
198 | **/ | ||||
199 | Q_PROPERTY(QString current READ current WRITE setCurrent NOTIFY currentChanged) | ||||
200 | /** | ||||
201 | * Whether navigation in the desktop layout wraps around at the borders. | ||||
202 | **/ | ||||
203 | Q_PROPERTY(bool navigationWrappingAround READ isNavigationWrappingAround WRITE setNavigationWrappingAround NOTIFY navigationWrappingAroundChanged) | ||||
204 | | ||||
205 | /** | ||||
206 | * list of key/value pairs which every one of them is representing a desktop | ||||
207 | */ | ||||
208 | Q_PROPERTY(KWin::DBusDesktopDataVector desktops READ desktops NOTIFY desktopsChanged); | ||||
209 | | ||||
210 | public: | ||||
211 | VirtualDesktopManagerDBusInterface(VirtualDesktopManager *parent); | ||||
212 | ~VirtualDesktopManagerDBusInterface() = default; | ||||
213 | | ||||
214 | uint count() const; | ||||
215 | | ||||
216 | void setRows(uint rows); | ||||
217 | uint rows() const; | ||||
218 | | ||||
219 | void setCurrent(const QString &id); | ||||
220 | QString current() const; | ||||
221 | | ||||
222 | void setNavigationWrappingAround(bool wraps); | ||||
223 | bool isNavigationWrappingAround() const; | ||||
224 | | ||||
225 | KWin::DBusDesktopDataVector desktops() const; | ||||
226 | | ||||
227 | Q_SIGNALS: | ||||
228 | void countChanged(uint count); | ||||
229 | void rowsChanged(uint rows); | ||||
230 | void currentChanged(const QString &id); | ||||
231 | void navigationWrappingAroundChanged(bool wraps); | ||||
232 | void desktopsChanged(KWin::DBusDesktopDataVector); | ||||
233 | void desktopDataChanged(const QString &id, KWin::DBusDesktopDataStruct); | ||||
234 | void desktopCreated(const QString &id, KWin::DBusDesktopDataStruct); | ||||
235 | void desktopRemoved(const QString &id); | ||||
236 | | ||||
237 | public Q_SLOTS: | ||||
238 | /** | ||||
239 | * Create a desktop with a new name at a given position | ||||
240 | * note: the position starts from 1 | ||||
241 | */ | ||||
242 | void createDesktop(uint position, const QString &name); | ||||
243 | void setDesktopName(const QString &id, const QString &name); | ||||
244 | void removeDesktop(const QString &id); | ||||
245 | | ||||
246 | private: | ||||
247 | VirtualDesktopManager *m_manager; | ||||
248 | }; | ||||
249 | | ||||
172 | } // namespace | 250 | } // namespace | ||
173 | 251 | | |||
252 | const QDBusArgument &operator<<(QDBusArgument &argument, const KWin::DBusDesktopDataStruct &desk); | ||||
253 | const QDBusArgument &operator>>(const QDBusArgument &argument, KWin::DBusDesktopDataStruct &desk); | ||||
254 | | ||||
255 | Q_DECLARE_METATYPE(KWin::DBusDesktopDataStruct) | ||||
256 | | ||||
257 | const QDBusArgument &operator<<(QDBusArgument &argument, const KWin::DBusDesktopDataVector &deskVector); | ||||
258 | const QDBusArgument &operator>>(const QDBusArgument &argument, KWin::DBusDesktopDataVector &deskVector); | ||||
259 | | ||||
260 | Q_DECLARE_METATYPE(KWin::DBusDesktopDataVector) | ||||
261 | | ||||
174 | #endif // KWIN_DBUS_INTERFACE_H | 262 | #endif // KWIN_DBUS_INTERFACE_H |