[PATCH] add ENV[XSERVER_PATH] to change xserver runtime

Maksim Melnikau maxposedon at gmail.com
Tue Aug 13 14:53:08 PDT 2013


Signed-off-by: Maksim Melnikau <maxposedon at gmail.com>
---
 man/weston.man          | 3 +++
 src/weston-launch.c     | 4 ++++
 src/xwayland/launcher.c | 9 +++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/man/weston.man b/man/weston.man
index 39d854b..a60d2bc 100644
--- a/man/weston.man
+++ b/man/weston.man
@@ -240,6 +240,9 @@ If set, specifies the directory where to look for
 .B XDG_RUNTIME_DIR
 The directory for Weston's socket and lock files.
 Wayland clients will automatically use this.
+.TP
+.B XWAYLAND_XSERVER_PATH
+Override xserver to run with XWayland integration.
 .
 .\" ***************************************************************
 .SH DIAGNOSTICS
diff --git a/src/weston-launch.c b/src/weston-launch.c
index 7264f7e..ec22cd9 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -504,6 +504,7 @@ setup_session(struct weston_launch *wl)
 {
 	char **env;
 	char *term;
+	char *xserver;
 	int i;
 
 	if (wl->tty != STDIN_FILENO) {
@@ -514,9 +515,12 @@ setup_session(struct weston_launch *wl)
 	}
 
 	term = getenv("TERM");
+	xserver = getenv("XWAYLAND_XSERVER_PATH");
 	clearenv();
 	if (term)
 		setenv("TERM", term, 1);
+	if (xserver)
+		setenv("XWAYLAND_XSERVER_PATH", xserver, 1);
 	setenv("USER", wl->pw->pw_name, 1);
 	setenv("LOGNAME", wl->pw->pw_name, 1);
 	setenv("HOME", wl->pw->pw_dir, 1);
diff --git a/src/xwayland/launcher.c b/src/xwayland/launcher.c
index b639479..82390b6 100644
--- a/src/xwayland/launcher.c
+++ b/src/xwayland/launcher.c
@@ -42,6 +42,7 @@ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
 	struct weston_xserver *wxs = data;
 	char display[8], s[8];
 	int sv[2], client_fd;
+	char *xserver = NULL;
 
 	if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
 		weston_log("socketpair failed\n");
@@ -62,8 +63,12 @@ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
 
 		snprintf(display, sizeof display, ":%d", wxs->display);
 
-		if (execl(XSERVER_PATH,
-			  XSERVER_PATH,
+		xserver = getenv("XWAYLAND_XSERVER_PATH");
+		if (!xserver)
+			  xserver = XSERVER_PATH;
+
+		if (execl(xserver,
+			  xserver,
 			  display,
 			  "-wayland",
 			  "-rootless",
-- 
1.8.3.2



More information about the wayland-devel mailing list