[PATCH weston v2 5/5] weston: Add a specific option to load XWayland

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Dec 18 13:26:34 UTC 2016


From: Quentin Glidic <sardemff7+git at sardemff7.net>

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 compositor/main.c      | 22 +++++++++++++++++-----
 man/weston.ini.man     |  7 +++++--
 man/weston.man         |  7 +++++--
 tests/weston-tests-env |  7 ++++---
 weston.ini.in          |  3 ++-
 5 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 74b404b..f9614f5 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -845,7 +845,7 @@ wet_load_shell(struct weston_compositor *compositor,
 
 static int
 load_modules(struct weston_compositor *ec, const char *modules,
-	     int *argc, char *argv[])
+	     int *argc, char *argv[], int32_t *xwayland)
 {
 	const char *p, *end;
 	char buffer[256];
@@ -859,8 +859,10 @@ load_modules(struct weston_compositor *ec, const char *modules,
 		snprintf(buffer, sizeof buffer, "%.*s", (int) (end - p), p);
 
 		if (strstr(buffer, "xwayland.so")) {
-			if (wet_load_xwayland(ec) < 0)
-				return -1;
+			weston_log("Old Xwayland module loading detected:"
+				   "Please use --xwayland command line option"
+				   "or weston.ini xwayland=true\n");
+			*xwayland = 1;
 		} else {
 			if (wet_load_module(ec, buffer, argc, argv) < 0)
 				return -1;
@@ -1756,6 +1758,7 @@ int main(int argc, char *argv[])
 	int i, fd;
 	char *backend = NULL;
 	char *shell = NULL;
+	int32_t xwayland = 0;
 	char *modules = NULL;
 	char *option_modules = NULL;
 	char *log = NULL;
@@ -1780,6 +1783,7 @@ int main(int argc, char *argv[])
 		{ WESTON_OPTION_STRING, "shell", 0, &shell },
 		{ WESTON_OPTION_STRING, "socket", 'S', &socket_name },
 		{ WESTON_OPTION_INTEGER, "idle-time", 'i', &idle_time },
+		{ WESTON_OPTION_BOOLEAN, "xwayland", 0, &xwayland },
 		{ WESTON_OPTION_STRING, "modules", 0, &option_modules },
 		{ WESTON_OPTION_STRING, "log", 0, &log },
 		{ WESTON_OPTION_BOOLEAN, "help", 'h', &help },
@@ -1914,12 +1918,20 @@ int main(int argc, char *argv[])
 		goto out;
 
 	weston_config_section_get_string(section, "modules", &modules, "");
-	if (load_modules(ec, modules, &argc, argv) < 0)
+	if (load_modules(ec, modules, &argc, argv, &xwayland) < 0)
 		goto out;
 
-	if (load_modules(ec, option_modules, &argc, argv) < 0)
+	if (load_modules(ec, option_modules, &argc, argv, &xwayland) < 0)
 		goto out;
 
+	if (!xwayland)
+		weston_config_section_get_bool(section, "xwayland", &xwayland,
+					       false);
+	if (xwayland) {
+		if (wet_load_xwayland(ec) < 0)
+			goto out;
+	}
+
 	section = weston_config_get_section(config, "keyboard", NULL, NULL);
 	weston_config_section_get_bool(section, "numlock-on", &numlock_on, 0);
 	if (numlock_on) {
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 2eac098..429dcdd 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -106,14 +106,17 @@ directory are:
 .fi
 .RE
 .TP 7
-.BI "modules=" xwayland.so,cms-colord.so
+.BI "xwayland=" true
+ask Weston to load the XWayland module (boolean).
+.RE
+.TP 7
+.BI "modules=" cms-colord.so,screen-share.so
 specifies the modules to load (string). Available modules in the
 .IR "__weston_modules_dir__"
 directory are:
 .PP
 .RS 10
 .nf
-.BR xwayland.so
 .BR cms-colord.so
 .BR screen-share.so
 .fi
diff --git a/man/weston.man b/man/weston.man
index 0c3e8dc..face229 100644
--- a/man/weston.man
+++ b/man/weston.man
@@ -83,7 +83,7 @@ the X server. XWayland provides backwards compatibility to X applications in a
 Wayland stack.
 
 XWayland is activated by instructing
-.BR weston " to load " xwayland.so " module, see " EXAMPLES .
+.BR weston " to load the XWayland module, see " EXAMPLES .
 Weston starts listening on a new X display socket, and exports it in the
 environment variable
 .BR DISPLAY .
@@ -143,6 +143,9 @@ Append log messages to the file
 .I file.log
 instead of writing them to stderr.
 .TP
+\fB\-\-xwayland\fR
+Ask Weston to load the XWayland module.
+.TP
 \fB\-\-modules\fR=\fImodule1.so,module2.so\fR
 Load the comma-separated list of modules. Only used by the test
 suite. The file is searched for in
@@ -326,7 +329,7 @@ http://wayland.freedesktop.org/
 .IP "Launch Weston with the DRM backend on a VT"
 weston-launch
 .IP "Launch Weston with the DRM backend and XWayland support"
-weston-launch -- --modules=xwayland.so
+weston-launch -- --xwayland
 .IP "Launch Weston (wayland-1) nested in another Weston instance (wayland-0)"
 WAYLAND_DISPLAY=wayland-0 weston -Swayland-1
 .IP "From an X terminal, launch Weston with the x11 backend"
diff --git a/tests/weston-tests-env b/tests/weston-tests-env
index 8a6447e..6da0696 100755
--- a/tests/weston-tests-env
+++ b/tests/weston-tests-env
@@ -24,7 +24,6 @@ MODDIR=$abs_builddir/.libs
 
 SHELL_PLUGIN=$MODDIR/desktop-shell.so
 TEST_PLUGIN=$MODDIR/weston-test.so
-XWAYLAND_PLUGIN=$MODDIR/xwayland.so
 
 CONFIG_FILE="${TEST_NAME}.ini"
 
@@ -60,7 +59,8 @@ case $TEST_FILE in
 			${CONFIG} \
 			--shell=$SHELL_PLUGIN \
 			--socket=test-${TEST_NAME} \
-			--modules=$MODDIR/${TEST_FILE/.la/.so},$XWAYLAND_PLUGIN \
+			--xwayland \
+			--modules=$MODDIR/${TEST_FILE/.la/.so} \
 			--log="$SERVERLOG" \
 			&> "$OUTLOG"
 		;;
@@ -89,7 +89,8 @@ case $TEST_FILE in
 			${CONFIG} \
 			--shell=$SHELL_PLUGIN \
 			--socket=test-${TEST_NAME} \
-			--modules=$TEST_PLUGIN,$XWAYLAND_PLUGIN \
+			--xwayland \
+			--modules=$TEST_PLUGIN \
 			--log="$SERVERLOG" \
 			$($abs_builddir/$TEST_FILE --params) \
 			&> "$OUTLOG"
diff --git a/weston.ini.in b/weston.ini.in
index d837fb5..11bf4ab 100644
--- a/weston.ini.in
+++ b/weston.ini.in
@@ -1,5 +1,6 @@
 [core]
-#modules=xwayland.so,cms-colord.so
+#modules=cms-colord.so
+#xwayland=true
 #shell=desktop-shell.so
 #gbm-format=xrgb2101010
 #require-input=true
-- 
2.10.0



More information about the wayland-devel mailing list