weston: Add a specific option to load XWayland
authorQuentin Glidic <sardemff7+git@sardemff7.net>
Mon, 4 Jul 2016 12:34:48 +0000 (14:34 +0200)
committerQuentin Glidic <sardemff7+git@sardemff7.net>
Tue, 17 Jan 2017 17:25:01 +0000 (18:25 +0100)
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
compositor/main.c
man/weston.ini.man
man/weston.man
tests/weston-tests-env
weston.ini.in

index 74b404b..f9614f5 100644 (file)
@@ -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) {
index 39a06fb..2edb085 100644 (file)
@@ -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
index 0c3e8dc..face229 100644 (file)
@@ -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"
index 8a6447e..6da0696 100755 (executable)
@@ -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"
index 71e879a..257c4ec 100644 (file)
@@ -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