[kwin_wayland] Do not require --display argument for starting X server

If display is not set, it won't be passed to the X command to start and
X will just pick the next free display id.
This commit is contained in:
Martin Gräßlin 2014-11-07 14:56:21 +01:00
parent 6f0ff3ff7e
commit 819c12819b

View file

@ -128,7 +128,11 @@ static void startXServer(const QByteArray &process, const QByteArray &display)
close(pipeFds[0]); close(pipeFds[0]);
char fdbuf[16]; char fdbuf[16];
sprintf(fdbuf, "%d", pipeFds[1]); sprintf(fdbuf, "%d", pipeFds[1]);
execlp(process.constData(), process.constData(), "-displayfd", fdbuf, display.constData(), (char *)0); if (display.isEmpty()) {
execlp(process.constData(), process.constData(), "-displayfd", fdbuf, (char *)0);
} else {
execlp(process.constData(), process.constData(), "-displayfd", fdbuf, display.constData(), (char *)0);
}
close(pipeFds[1]); close(pipeFds[1]);
exit(20); exit(20);
} }
@ -231,7 +235,7 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
i18n("Start a nested X Server."), i18n("Start a nested X Server."),
QStringLiteral("xephyr|xvfb|xwayland")); QStringLiteral("xephyr|xvfb|xwayland"));
QCommandLineOption x11DisplayOption(QStringLiteral("display"), QCommandLineOption x11DisplayOption(QStringLiteral("display"),
i18n("The X11 Display to connect to, required if option x-server is used."), i18n("The X11 Display to connect to. If not set next free number will be picked."),
QStringLiteral("display")); QStringLiteral("display"));
QCommandLineParser parser; QCommandLineParser parser;