diff --git a/atoms.cpp b/atoms.cpp index 98cd091d33..c530598581 100644 --- a/atoms.cpp +++ b/atoms.cpp @@ -56,6 +56,8 @@ Atoms::Atoms() , kde_skip_close_animation(QByteArrayLiteral("_KDE_NET_WM_SKIP_CLOSE_ANIMATION")) , kde_screen_edge_show(QByteArrayLiteral("_KDE_NET_WM_SCREEN_EDGE_SHOW")) , gtk_frame_extents(QByteArrayLiteral("_GTK_FRAME_EXTENTS")) + , kwin_dbus_service(QByteArrayLiteral("_ORG_KDE_KWIN_DBUS_SERVICE")) + , utf8_string(QByteArrayLiteral("UTF8_STRING")) , m_dtSmWindowInfo(QByteArrayLiteral("_DT_SM_WINDOW_INFO")) , m_motifSupport(QByteArrayLiteral("_MOTIF_WM_INFO")) , m_helpersRetrieved(false) diff --git a/atoms.h b/atoms.h index 0873d5e442..ecbc52cb60 100644 --- a/atoms.h +++ b/atoms.h @@ -65,6 +65,8 @@ public: Xcb::Atom kde_skip_close_animation; Xcb::Atom kde_screen_edge_show; Xcb::Atom gtk_frame_extents; + Xcb::Atom kwin_dbus_service; + Xcb::Atom utf8_string; /** * @internal diff --git a/dbusinterface.cpp b/dbusinterface.cpp index 0b13bf3517..e852c139c2 100644 --- a/dbusinterface.cpp +++ b/dbusinterface.cpp @@ -23,6 +23,7 @@ along with this program. If not, see . #include "compositingadaptor.h" // kwin +#include "atoms.h" #include "composite.h" #include "compositingprefs.h" #include "main.h" @@ -56,6 +57,8 @@ DBusInterface::DBusInterface(QObject *parent) if (!dbus.registerService(m_serviceName)) { QDBusServiceWatcher *dog = new QDBusServiceWatcher(m_serviceName, dbus, QDBusServiceWatcher::WatchForUnregistration, this); connect (dog, SIGNAL(serviceUnregistered(QString)), SLOT(becomeKWinService(QString))); + } else { + announceService(); } dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"), Workspace::self(), SLOT(slotReloadConfig())); @@ -67,6 +70,7 @@ void DBusInterface::becomeKWinService(const QString &service) // but it's probably no longer needed since we explicitly unregister the service with the deconstructor if (service == m_serviceName && QDBusConnection::sessionBus().registerService(m_serviceName) && sender()) { sender()->deleteLater(); // bye doggy :'( + announceService(); } } @@ -75,6 +79,14 @@ DBusInterface::~DBusInterface() QDBusConnection::sessionBus().unregisterService(m_serviceName); // KApplication automatically also grabs org.kde.kwin, so it's often been used externally - ensure to free it as well QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.kwin")); + xcb_delete_property(connection(), rootWindow(), atoms->kwin_dbus_service); +} + +void DBusInterface::announceService() +{ + const QByteArray service = m_serviceName.toUtf8(); + xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, rootWindow(), atoms->kwin_dbus_service, + atoms->utf8_string, 8, service.size(), service.constData()); } // wrap void methods with no arguments to Workspace diff --git a/dbusinterface.h b/dbusinterface.h index 83ab9e7306..19e9cb529e 100644 --- a/dbusinterface.h +++ b/dbusinterface.h @@ -69,6 +69,7 @@ private Q_SLOTS: void becomeKWinService(const QString &service); private: + void announceService(); QString m_serviceName; };