From 8cb78b7df6c88056f4defc0b9f10a33ebff971aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 23 Jan 2015 09:48:55 +0100 Subject: [PATCH] Use KWIN_DBUS_SERVICE_SUFFIX for multi-head service name wrangling Adjust the KWIN_DBUS_SERVICE_SUFFIX env variable in a multi-head scenario instead of adjusting the "org.kde.kwin" DBus service which we actually don't use in 5.x any more. REVIEW: 122217 --- main.cpp | 12 ------------ main.h | 2 -- main_wayland.cpp | 3 --- main_x11.cpp | 9 ++++++--- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/main.cpp b/main.cpp index d038fb5243..44d8c4956c 100644 --- a/main.cpp +++ b/main.cpp @@ -298,18 +298,6 @@ void Application::processCommandLine(QCommandLineParser *parser) Application::setCrashCount(parser->value(s_crashesOption).toInt()); } -void Application::registerDBusService() -{ - QString appname; - if (x11ScreenNumber() == 0) - appname = QStringLiteral("org.kde.kwin"); - else - appname.sprintf("org.kde.kwin-screen-%d", KWin::Application::x11ScreenNumber()); - - QDBusConnection::sessionBus().interface()->registerService( - appname, QDBusConnectionInterface::DontQueueService); -} - void Application::setupTranslator() { QTranslator *qtTranslator = new QTranslator(qApp); diff --git a/main.h b/main.h index 43faab1c1d..31b5b39457 100644 --- a/main.h +++ b/main.h @@ -82,8 +82,6 @@ public: void setupCommandLine(QCommandLineParser *parser); void processCommandLine(QCommandLineParser *parser); - void registerDBusService(); - static void setCrashCount(int count); static bool wasCrash(); diff --git a/main_wayland.cpp b/main_wayland.cpp index d8d67f65be..0a7f9d61bf 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -270,8 +270,5 @@ KWIN_EXPORT int kdemain(int argc, char * argv[]) a.start(); - // TODO: is this still needed? - a.registerDBusService(); - return a.exec(); } diff --git a/main_x11.cpp b/main_x11.cpp index 738486eb65..d7f53d391a 100644 --- a/main_x11.cpp +++ b/main_x11.cpp @@ -224,6 +224,12 @@ KWIN_EXPORT int kdemain(int argc, char * argv[]) // acts exactly as previously if (i != KWin::Application::x11ScreenNumber() && fork() == 0) { KWin::Application::setX11ScreenNumber(i); + QByteArray dBusSuffix = qgetenv("KWIN_DBUS_SERVICE_SUFFIX"); + if (!dBusSuffix.isNull()) { + dBusSuffix.append("."); + } + dBusSuffix.append(QByteArrayLiteral("head-")).append(QByteArray::number(i)); + qputenv("KWIN_DBUS_SERVICE_SUFFIX", dBusSuffix); // Break here because we are the child process, we don't // want to fork() anymore break; @@ -288,8 +294,5 @@ KWIN_EXPORT int kdemain(int argc, char * argv[]) #endif KWin::SessionSaveDoneHelper helper; - // TODO: is this still needed? - a.registerDBusService(); - return a.exec(); }