[xwayland] Drop options to start Xephyr or Xvfb
Only --xwayland stays supported. The option --displayfd and --rootless are always set. Simplifies the feature matrix and the other X servers don't make any sense now that we can start a proper rootless Xwayland.icc-effect-5.14.5
parent
47bdce074e
commit
7843bbdbfb
|
@ -109,18 +109,14 @@ void ApplicationWayland::performStartup()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the X-Server with binary name @p process on @p display.
|
* Starts the Xwayland-Server.
|
||||||
* The new process is started by forking into it.
|
* The new process is started by forking into it.
|
||||||
**/
|
**/
|
||||||
static int startXServer(const QByteArray &process, const QByteArray &display, bool rootless = false, const QByteArray &waylandSocket = QByteArray())
|
static int startXServer(const QByteArray &waylandSocket)
|
||||||
{
|
{
|
||||||
int pipeFds[2];
|
int pipeFds[2];
|
||||||
if (pipe(pipeFds) != 0) {
|
if (pipe(pipeFds) != 0) {
|
||||||
std::cerr << "FATAL ERROR failed to create pipe to start X Server "
|
std::cerr << "FATAL ERROR failed to create pipe to start Xwayland " << std::endl;
|
||||||
<< process.constData()
|
|
||||||
<< " with arguments "
|
|
||||||
<< display.constData()
|
|
||||||
<< std::endl;
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,20 +127,8 @@ static int startXServer(const QByteArray &process, const QByteArray &display, bo
|
||||||
close(pipeFds[0]);
|
close(pipeFds[0]);
|
||||||
char fdbuf[16];
|
char fdbuf[16];
|
||||||
sprintf(fdbuf, "%d", pipeFds[1]);
|
sprintf(fdbuf, "%d", pipeFds[1]);
|
||||||
char *args[5];
|
|
||||||
char **index = args;
|
|
||||||
*index++ = const_cast<char*>(process.constData());
|
|
||||||
*index++ = "-displayfd";
|
|
||||||
*index++ = fdbuf;
|
|
||||||
if (rootless) {
|
|
||||||
*index++ = "-rootless";
|
|
||||||
}
|
|
||||||
if (!display.isEmpty()) {
|
|
||||||
*index++ = const_cast<char*>(display.data());
|
|
||||||
}
|
|
||||||
*index++ = nullptr;
|
|
||||||
qputenv("WAYLAND_DISPLAY", waylandSocket.isEmpty() ? QByteArrayLiteral("wayland-0") : waylandSocket);
|
qputenv("WAYLAND_DISPLAY", waylandSocket.isEmpty() ? QByteArrayLiteral("wayland-0") : waylandSocket);
|
||||||
execvp(process.constData(), args);
|
execlp("Xwayland", "Xwayland", "-displayfd", fdbuf, "-rootless", (char *)0);
|
||||||
close(pipeFds[1]);
|
close(pipeFds[1]);
|
||||||
exit(20);
|
exit(20);
|
||||||
}
|
}
|
||||||
|
@ -178,38 +162,13 @@ static void readDisplay(int pipe)
|
||||||
extern "C"
|
extern "C"
|
||||||
KWIN_EXPORT int kdemain(int argc, char * argv[])
|
KWIN_EXPORT int kdemain(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
// process command line arguments to figure out whether we have to start an X-Server
|
// process command line arguments to figure out whether we have to start Xwayland and the Wayland socket
|
||||||
bool startXephyr = false;
|
|
||||||
bool startXvfb = false;
|
|
||||||
bool startXwayland = false;
|
bool startXwayland = false;
|
||||||
bool rootlessXwayland = false;
|
|
||||||
QByteArray xDisplay;
|
|
||||||
QByteArray xServer;
|
|
||||||
QByteArray waylandSocket;
|
QByteArray waylandSocket;
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
QByteArray arg = QByteArray::fromRawData(argv[i], qstrlen(argv[i]));
|
QByteArray arg = QByteArray::fromRawData(argv[i], qstrlen(argv[i]));
|
||||||
if (arg == "-x" || arg == "--x-server") {
|
|
||||||
if (++i < argc) {
|
|
||||||
xServer = QByteArray::fromRawData(argv[i], qstrlen(argv[i]));
|
|
||||||
}
|
|
||||||
startXephyr = (xServer == "xephyr");
|
|
||||||
startXvfb = (xServer == "xvfb");
|
|
||||||
startXwayland = (xServer == "xwayland");
|
|
||||||
if (!startXephyr && !startXvfb && !startXwayland) {
|
|
||||||
fprintf(stderr, "%s: FATAL ERROR unknown X-Server %s specified to start\n",
|
|
||||||
argv[0], qPrintable(xServer));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg == "--xwayland") {
|
if (arg == "--xwayland") {
|
||||||
startXwayland = true;
|
startXwayland = true;
|
||||||
rootlessXwayland = true;
|
|
||||||
}
|
|
||||||
if (arg == "--display") {
|
|
||||||
if (++i < argc) {
|
|
||||||
xDisplay = QByteArray::fromRawData(argv[i], qstrlen(argv[i]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (arg == "--socket" || arg == "-s") {
|
if (arg == "--socket" || arg == "-s") {
|
||||||
if (++i < argc) {
|
if (++i < argc) {
|
||||||
|
@ -225,15 +184,8 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
|
||||||
KWin::WaylandServer *server = KWin::WaylandServer::create(nullptr);
|
KWin::WaylandServer *server = KWin::WaylandServer::create(nullptr);
|
||||||
server->init(waylandSocket);
|
server->init(waylandSocket);
|
||||||
|
|
||||||
int xDisplayPipe = -1;
|
|
||||||
if (startXephyr) {
|
|
||||||
xDisplayPipe = KWin::startXServer(QByteArrayLiteral("Xephyr"), xDisplay);
|
|
||||||
}
|
|
||||||
if (startXvfb) {
|
|
||||||
xDisplayPipe = KWin::startXServer(QByteArrayLiteral("Xvfb"), xDisplay);
|
|
||||||
}
|
|
||||||
if (startXwayland) {
|
if (startXwayland) {
|
||||||
xDisplayPipe = KWin::startXServer(QByteArrayLiteral("Xwayland"), xDisplay, rootlessXwayland, waylandSocket);
|
const int xDisplayPipe = KWin::startXServer(waylandSocket);
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
|
@ -243,9 +195,6 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(xDisplayPipe, &rfds);
|
FD_SET(xDisplayPipe, &rfds);
|
||||||
} while (select(xDisplayPipe + 1, &rfds, NULL, NULL, &tv) == 0);
|
} while (select(xDisplayPipe + 1, &rfds, NULL, NULL, &tv) == 0);
|
||||||
}
|
|
||||||
|
|
||||||
if (xDisplayPipe != -1) {
|
|
||||||
KWin::readDisplay(xDisplayPipe);
|
KWin::readDisplay(xDisplayPipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,23 +227,15 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
|
||||||
|
|
||||||
KWin::Application::createAboutData();
|
KWin::Application::createAboutData();
|
||||||
|
|
||||||
QCommandLineOption startXServerOption(QStringList({QStringLiteral("x"), QStringLiteral("x-server")}),
|
|
||||||
i18n("Start a nested X Server."),
|
|
||||||
QStringLiteral("xephyr|xvfb|xwayland"));
|
|
||||||
QCommandLineOption xwaylandOption(QStringLiteral("xwayland"),
|
QCommandLineOption xwaylandOption(QStringLiteral("xwayland"),
|
||||||
i18n("Start a rootless Xwayland server. Implies --x-server=xwayland."));
|
i18n("Start a rootless Xwayland server."));
|
||||||
QCommandLineOption x11DisplayOption(QStringLiteral("display"),
|
|
||||||
i18n("The X11 Display to connect to. If not set next free number will be picked."),
|
|
||||||
QStringLiteral("display"));
|
|
||||||
QCommandLineOption waylandSocketOption(QStringList{QStringLiteral("s"), QStringLiteral("socket")},
|
QCommandLineOption waylandSocketOption(QStringList{QStringLiteral("s"), QStringLiteral("socket")},
|
||||||
i18n("Name of the Wayland socket to listen on. If not set \"wayland-0\" is used."),
|
i18n("Name of the Wayland socket to listen on. If not set \"wayland-0\" is used."),
|
||||||
QStringLiteral("socket"));
|
QStringLiteral("socket"));
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
a.setupCommandLine(&parser);
|
a.setupCommandLine(&parser);
|
||||||
parser.addOption(startXServerOption);
|
|
||||||
parser.addOption(xwaylandOption);
|
parser.addOption(xwaylandOption);
|
||||||
parser.addOption(x11DisplayOption);
|
|
||||||
parser.addOption(waylandSocketOption);
|
parser.addOption(waylandSocketOption);
|
||||||
#if HAVE_INPUT
|
#if HAVE_INPUT
|
||||||
QCommandLineOption libinputOption(QStringLiteral("libinput"),
|
QCommandLineOption libinputOption(QStringLiteral("libinput"),
|
||||||
|
|
Loading…
Reference in New Issue