compositor-fbdev: support the --seat option, (and XDG_SEAT variable)
authornerdopolis <bluescreen_avenger@verizon.net>
Fri, 29 Jun 2018 12:17:47 +0000 (08:17 -0400)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 2 Jul 2018 12:29:38 +0000 (15:29 +0300)
This allows the fbdev backend to run on, and use devices from the
specified seat, similar to the drm backend.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
compositor/main.c
libweston/compositor-fbdev.c
libweston/compositor-fbdev.h

index 04d8ff016450ac8968e506ca3078968de15a4b7d..89e389b212cd55b5a156dfd79cfcf2d454ef5f42 100644 (file)
@@ -525,6 +525,7 @@ usage(int error_code)
                "Options for fbdev-backend.so:\n\n"
                "  --tty=TTY\t\tThe tty to use\n"
                "  --device=DEVICE\tThe framebuffer device to use\n"
+               "  --seat=SEAT\t\tThe seat that weston should run on, instead of the seat defined in XDG_SEAT\n"
                "\n");
 #endif
 
@@ -2059,6 +2060,7 @@ load_fbdev_backend(struct weston_compositor *c,
        const struct weston_option fbdev_options[] = {
                { WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
                { WESTON_OPTION_STRING, "device", 0, &config.device },
+               { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
        };
 
        parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
index a78f6fab66ffac09e17f96ed6d259af2a4c0a99b..09a2eb39fed52413e50bb681c1cbb123ba9ccb90 100644 (file)
@@ -776,6 +776,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
 {
        struct fbdev_backend *backend;
        const char *seat_id = default_seat;
+       const char *session_seat;
+
+       session_seat = getenv("XDG_SEAT");
+       if (session_seat)
+               seat_id = session_seat;
+       if (param->seat_id)
+               seat_id = param->seat_id;
 
        weston_log("initializing fbdev backend\n");
 
@@ -800,7 +807,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
        wl_signal_add(&compositor->session_signal,
                      &backend->session_listener);
        compositor->launcher =
-               weston_launcher_connect(compositor, param->tty, "seat0", false);
+               weston_launcher_connect(compositor, param->tty, seat_id, false);
        if (!compositor->launcher) {
                weston_log("fatal: fbdev backend should be run using "
                           "weston-launch binary, or your system should "
@@ -846,6 +853,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
         * udev, rather than passing a device node in as a parameter. */
        config->tty = 0; /* default to current tty */
        config->device = "/dev/fb0"; /* default frame buffer */
+       config->seat_id = NULL;
 }
 
 WL_EXPORT int
index 8b7d900e7bcafa7526da21d4a15469ceeb9ca069..29c21828efa880db2f1035ac8cbc69dd6bb6e880 100644 (file)
@@ -52,6 +52,15 @@ struct weston_fbdev_backend_config {
         */
        void (*configure_device)(struct weston_compositor *compositor,
                                 struct libinput_device *device);
+
+       /** The seat to be used for input and output.
+        *
+        * If seat_id is NULL, the seat is taken from XDG_SEAT environment
+        * variable. If neither is set, "seat0" is used. The backend will
+        * take ownership of the seat_id pointer and will free it on
+        * backend destruction.
+        */
+       char *seat_id;
 };
 
 #ifdef  __cplusplus