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
icc-effect-5.14.5
Martin Gräßlin 2015-01-23 09:48:55 +01:00
parent 861e7a5739
commit 8cb78b7df6
4 changed files with 6 additions and 20 deletions

View File

@ -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);

2
main.h
View File

@ -82,8 +82,6 @@ public:
void setupCommandLine(QCommandLineParser *parser);
void processCommandLine(QCommandLineParser *parser);
void registerDBusService();
static void setCrashCount(int count);
static bool wasCrash();

View File

@ -270,8 +270,5 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
a.start();
// TODO: is this still needed?
a.registerDBusService();
return a.exec();
}

View File

@ -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();
}