[PATCH weston 1/3] weston: Add a specific option to load XWayland

Quentin Glidic sardemff7+wayland at sardemff7.net
Mon Jul 4 13:58:07 UTC 2016


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

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

diff --git a/compositor/main.c b/compositor/main.c
index 6cf9194..4e6b7ae 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -763,16 +763,11 @@ load_modules(struct weston_compositor *ec, const char *modules,
 		end = strchrnul(p, ',');
 		snprintf(buffer, sizeof buffer, "%.*s", (int) (end - p), p);
 
-		if (strstr(buffer, "xwayland.so")) {
-			if (wet_load_xwayland(ec) < 0)
-				return -1;
-		} else {
-			module_init = wet_load_module(buffer, "module_init");
-			if (!module_init)
-				return -1;
-			if (module_init(ec, argc, argv) < 0)
-				return -1;
-		}
+		module_init = wet_load_module(buffer, "module_init");
+		if (!module_init)
+			return -1;
+		if (module_init(ec, argc, argv) < 0)
+			return -1;
 		p = end;
 		while (*p == ',')
 			p++;
@@ -1564,6 +1559,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;
@@ -1586,6 +1582,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 },
@@ -1709,6 +1706,14 @@ int main(int argc, char *argv[])
 		weston_config_section_get_string(section, "shell", &shell,
 						 "desktop-shell.so");
 
+	if (!xwayland)
+		weston_config_section_get_bool(section, "xwayland", &xwayland,
+					       false);
+	if (xwayland) {
+		if (wet_load_xwayland(ec) < 0)
+			goto out;
+	}
+
 	if (load_modules(ec, shell, &argc, argv) < 0)
 		goto out;
 
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 7aa7810..1b1e05a 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..4159809 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 14a4c0c..9be273f 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
 
-- 
2.9.0



More information about the wayland-devel mailing list