KWin
Loading...
Searching...
No Matches
dbusinterface.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2012 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include <QDBusContext>
13#include <QDBusMessage>
14#include <QObject>
15
17
18namespace KWin
19{
20
21class Compositor;
22class PluginManager;
23class VirtualDesktopManager;
24
39class DBusInterface : public QObject, protected QDBusContext
40{
41 Q_OBJECT
42 Q_CLASSINFO("D-Bus Interface", "org.kde.KWin")
43public:
44 explicit DBusInterface(QObject *parent);
45 ~DBusInterface() override;
46
47public: // PROPERTIES
49 bool showingDesktop() const;
50
51public Q_SLOTS: // METHODS
52 Q_NOREPLY void cascadeDesktop();
53 int currentDesktop();
54 Q_NOREPLY void killWindow();
55 void nextDesktop();
56 void previousDesktop();
57 Q_NOREPLY void reconfigure();
58 bool setCurrentDesktop(int desktop);
59 bool startActivity(const QString &in0);
60 bool stopActivity(const QString &in0);
61 QString supportInformation();
62 QString activeOutputName();
63 Q_NOREPLY void unclutterDesktop();
64 Q_NOREPLY void showDebugConsole();
65
71 Q_NOREPLY void replace();
72
81 QVariantMap queryWindowInfo();
82
90 QVariantMap getWindowInfo(const QString &uuid);
91
92 Q_NOREPLY void showDesktop(bool show);
93
94Q_SIGNALS:
95 void showingDesktopChanged(bool showing);
96
97private Q_SLOTS:
98 void onShowingDesktopChanged(bool show, bool /*animated*/);
99
100private:
101 QString m_serviceName;
102 QDBusMessage m_replyQueryWindowInfo;
103};
104
105class CompositorDBusInterface : public QObject
106{
107 Q_OBJECT
108 Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Compositing")
109
110
114 Q_PROPERTY(bool active READ isActive)
115
121
126
130 Q_PROPERTY(bool openGLIsBroken READ isOpenGLBroken)
131
139 Q_PROPERTY(QString compositingType READ compositingType)
140
151
153public:
155 ~CompositorDBusInterface() override = default;
156
157 bool isActive() const;
158 bool isCompositingPossible() const;
159 QString compositingNotPossibleReason() const;
160 bool isOpenGLBroken() const;
161 QString compositingType() const;
162 QStringList supportedOpenGLPlatformInterfaces() const;
163 bool platformRequiresCompositing() const;
164
165public Q_SLOTS:
171 void reinitialize();
172
173Q_SIGNALS:
175
176private:
177 Compositor *m_compositor;
178};
179
180// TODO: disable all of this in case of kiosk?
181
183{
184 Q_OBJECT
185 Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.VirtualDesktopManager")
186
187
191 Q_PROPERTY(uint count READ count NOTIFY countChanged)
192
196 Q_PROPERTY(uint rows READ rows WRITE setRows NOTIFY rowsChanged)
197
201 Q_PROPERTY(QString current READ current WRITE setCurrent NOTIFY currentChanged)
202
206 Q_PROPERTY(bool navigationWrappingAround READ isNavigationWrappingAround WRITE setNavigationWrappingAround NOTIFY navigationWrappingAroundChanged)
207
211 Q_PROPERTY(KWin::DBusDesktopDataVector desktops READ desktops NOTIFY desktopsChanged);
212
213public:
216
217 uint count() const;
218
219 void setRows(uint rows);
220 uint rows() const;
221
222 void setCurrent(const QString &id);
223 QString current() const;
224
225 void setNavigationWrappingAround(bool wraps);
226 bool isNavigationWrappingAround() const;
227
228 KWin::DBusDesktopDataVector desktops() const;
229
230Q_SIGNALS:
231 void countChanged(uint count);
232 void rowsChanged(uint rows);
233 void currentChanged(const QString &id);
234 void navigationWrappingAroundChanged(bool wraps);
235 void desktopsChanged(KWin::DBusDesktopDataVector);
236 void desktopDataChanged(const QString &id, KWin::DBusDesktopDataStruct);
237 void desktopCreated(const QString &id, KWin::DBusDesktopDataStruct);
238 void desktopRemoved(const QString &id);
239
240public Q_SLOTS:
245 void createDesktop(uint position, const QString &name);
246 void setDesktopName(const QString &id, const QString &name);
247 void removeDesktop(const QString &id);
248
249private:
250 VirtualDesktopManager *m_manager;
251};
252
253class PluginManagerDBusInterface : public QObject
254{
255 Q_OBJECT
256 Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.Plugins")
257
258 Q_PROPERTY(QStringList LoadedPlugins READ loadedPlugins)
259 Q_PROPERTY(QStringList AvailablePlugins READ availablePlugins)
260
261public:
263
264 QStringList loadedPlugins() const;
265 QStringList availablePlugins() const;
266
267public Q_SLOTS:
268 bool LoadPlugin(const QString &name);
269 void UnloadPlugin(const QString &name);
270
271private:
272 PluginManager *m_manager;
273};
274
275} // namespace
bool active
Whether the Compositor is active. That is a Scene is present and the Compositor is not shutting down ...
QString compositingNotPossibleReason
The reason why compositing is not possible. Empty String if compositing is possible.
QStringList supportedOpenGLPlatformInterfaces
All currently supported OpenGLPlatformInterfaces.
void compositingToggled(bool active)
void reinitialize()
Used by Compositing KCM after settings change.
bool compositingPossible
Whether compositing is possible. Mostly means whether the required X extensions are available.
bool openGLIsBroken
Whether OpenGL has failed badly in the past (crash) and is considered as broken.
This class is a wrapper for the org.kde.KWin D-Bus interface.
bool stopActivity(const QString &in0)
Q_NOREPLY void unclutterDesktop()
bool setCurrentDesktop(int desktop)
Q_NOREPLY void showDebugConsole()
bool startActivity(const QString &in0)
DBusInterface(QObject *parent)
Q_NOREPLY void replace()
QVariantMap queryWindowInfo()
Q_NOREPLY void showDesktop(bool show)
Q_NOREPLY void cascadeDesktop()
Q_NOREPLY void reconfigure()
void showingDesktopChanged(bool showing)
Q_NOREPLY void killWindow()
QVariantMap getWindowInfo(const QString &uuid)
Manages the number of available virtual desktops, the layout of those and which virtual desktop is th...
QList< DBusDesktopDataStruct > DBusDesktopDataVector
#define private
#define explicit