2012-08-30 06:20:26 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_DBUS_INTERFACE_H
|
|
|
|
#define KWIN_DBUS_INTERFACE_H
|
|
|
|
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QObject>
|
2018-06-05 10:52:57 +00:00
|
|
|
#include <QtDBus>
|
2012-08-30 06:20:26 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2014-06-02 06:51:28 +00:00
|
|
|
class Compositor;
|
|
|
|
|
2012-08-30 06:20:26 +00:00
|
|
|
/**
|
|
|
|
* @brief This class is a wrapper for the org.kde.KWin D-Bus interface.
|
|
|
|
*
|
|
|
|
* The main purpose of this class is to be exported on the D-Bus as object /KWin.
|
|
|
|
* It is a pure wrapper to provide the deprecated D-Bus methods which have been
|
|
|
|
* removed from Workspace which used to implement the complete D-Bus interface.
|
|
|
|
*
|
|
|
|
* Nowadays the D-Bus interfaces are distributed, parts of it are exported on
|
|
|
|
* /Compositor, parts on /Effects and parts on /KWin. The implementation in this
|
|
|
|
* class just delegates the method calls to the actual implementation in one of the
|
|
|
|
* three singletons.
|
|
|
|
*
|
|
|
|
* @author Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
**/
|
2018-02-12 20:40:05 +00:00
|
|
|
class DBusInterface: public QObject, protected QDBusContext
|
2012-08-30 06:20:26 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin")
|
|
|
|
public:
|
2012-12-29 06:34:38 +00:00
|
|
|
explicit DBusInterface(QObject *parent);
|
2012-08-30 06:20:26 +00:00
|
|
|
virtual ~DBusInterface();
|
|
|
|
|
|
|
|
public: // PROPERTIES
|
|
|
|
public Q_SLOTS: // METHODS
|
|
|
|
Q_NOREPLY void cascadeDesktop();
|
|
|
|
int currentDesktop();
|
|
|
|
Q_NOREPLY void killWindow();
|
|
|
|
void nextDesktop();
|
|
|
|
void previousDesktop();
|
|
|
|
Q_NOREPLY void reconfigure();
|
|
|
|
bool setCurrentDesktop(int desktop);
|
|
|
|
bool startActivity(const QString &in0);
|
|
|
|
bool stopActivity(const QString &in0);
|
|
|
|
QString supportInformation();
|
|
|
|
Q_NOREPLY void unclutterDesktop();
|
2016-03-14 09:23:52 +00:00
|
|
|
Q_NOREPLY void showDebugConsole();
|
2012-08-30 06:20:26 +00:00
|
|
|
|
2018-02-12 20:40:05 +00:00
|
|
|
QVariantMap queryWindowInfo();
|
|
|
|
|
2012-12-29 23:15:30 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void becomeKWinService(const QString &service);
|
2014-10-13 20:35:04 +00:00
|
|
|
|
|
|
|
private:
|
2015-01-23 08:06:05 +00:00
|
|
|
void announceService();
|
2014-10-13 20:35:04 +00:00
|
|
|
QString m_serviceName;
|
2018-02-12 20:40:05 +00:00
|
|
|
QDBusMessage m_replyQueryWindowInfo;
|
2012-08-30 06:20:26 +00:00
|
|
|
};
|
|
|
|
|
2014-06-02 06:51:28 +00:00
|
|
|
class CompositorDBusInterface : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Compositing")
|
|
|
|
/**
|
|
|
|
* @brief Whether the Compositor is active. That is a Scene is present and the Compositor is
|
|
|
|
* not shutting down itself.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool active READ isActive)
|
|
|
|
/**
|
|
|
|
* @brief Whether compositing is possible. Mostly means whether the required X extensions
|
|
|
|
* are available.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool compositingPossible READ isCompositingPossible)
|
|
|
|
/**
|
|
|
|
* @brief The reason why compositing is not possible. Empty String if compositing is possible.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QString compositingNotPossibleReason READ compositingNotPossibleReason)
|
|
|
|
/**
|
|
|
|
* @brief Whether OpenGL has failed badly in the past (crash) and is considered as broken.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool openGLIsBroken READ isOpenGLBroken)
|
|
|
|
/**
|
|
|
|
* The type of the currently used Scene:
|
|
|
|
* @li @c none No Compositing
|
|
|
|
* @li @c xrender XRender
|
|
|
|
* @li @c gl1 OpenGL 1
|
|
|
|
* @li @c gl2 OpenGL 2
|
|
|
|
* @li @c gles OpenGL ES 2
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QString compositingType READ compositingType)
|
|
|
|
/**
|
|
|
|
* @brief All currently supported OpenGLPlatformInterfaces.
|
|
|
|
*
|
|
|
|
* Possible values:
|
|
|
|
* @li glx
|
|
|
|
* @li egl
|
|
|
|
*
|
|
|
|
* Values depend on operation mode and compile time options.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QStringList supportedOpenGLPlatformInterfaces READ supportedOpenGLPlatformInterfaces)
|
2016-08-26 10:56:25 +00:00
|
|
|
Q_PROPERTY(bool platformRequiresCompositing READ platformRequiresCompositing)
|
2014-06-02 06:51:28 +00:00
|
|
|
public:
|
|
|
|
explicit CompositorDBusInterface(Compositor *parent);
|
|
|
|
virtual ~CompositorDBusInterface() = default;
|
|
|
|
|
|
|
|
bool isActive() const;
|
|
|
|
bool isCompositingPossible() const;
|
|
|
|
QString compositingNotPossibleReason() const;
|
|
|
|
bool isOpenGLBroken() const;
|
|
|
|
QString compositingType() const;
|
|
|
|
QStringList supportedOpenGLPlatformInterfaces() const;
|
2016-08-26 10:56:25 +00:00
|
|
|
bool platformRequiresCompositing() const;
|
2014-06-02 06:51:28 +00:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
/**
|
|
|
|
* @brief Suspends the Compositor if it is currently active.
|
|
|
|
*
|
|
|
|
* Note: it is possible that the Compositor is not able to suspend. Use @link isActive to check
|
|
|
|
* whether the Compositor has been suspended.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @see resume
|
|
|
|
* @see isActive
|
|
|
|
**/
|
|
|
|
void suspend();
|
|
|
|
/**
|
|
|
|
* @brief Resumes the Compositor if it is currently suspended.
|
|
|
|
*
|
|
|
|
* Note: it is possible that the Compositor cannot be resumed, that is there might be Clients
|
|
|
|
* blocking the usage of Compositing or the Scene might be broken. Use @link isActive to check
|
|
|
|
* whether the Compositor has been resumed. Also check @link isCompositingPossible and
|
|
|
|
* @link isOpenGLBroken.
|
|
|
|
*
|
|
|
|
* Note: The starting of the Compositor can require some time and is partially done threaded.
|
|
|
|
* After this method returns the setup may not have been completed.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @see suspend
|
|
|
|
* @see isActive
|
|
|
|
* @see isCompositingPossible
|
|
|
|
* @see isOpenGLBroken
|
|
|
|
**/
|
|
|
|
void resume();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void compositingToggled(bool active);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Compositor *m_compositor;
|
|
|
|
};
|
|
|
|
|
2012-08-30 06:20:26 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif // KWIN_DBUS_INTERFACE_H
|