[PATCH 1/6] libweston: set the seat automatically based on the XDG_SEAT environment variable

nerdopolis bluescreen_avenger at verizon.net
Wed Sep 6 01:19:58 UTC 2017


---
 compositor/main.c            | 2 +-
 libweston/compositor-drm.c   | 5 +++++
 libweston/compositor-fbdev.c | 5 +++++
 man/weston-drm.man           | 7 +++++--
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 0615d87e..61bda282 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -562,7 +562,7 @@ usage(int error_code)
 #if defined(BUILD_DRM_COMPOSITOR)
 	fprintf(stderr,
 		"Options for drm-backend.so:\n\n"
-		"  --seat=SEAT\t\tThe seat that weston should run on\n"
+		"  --seat=SEAT\t\tThe seat that weston should run on, instead of the seat defined in XDG_SEAT\n"
 		"  --tty=TTY\t\tThe tty to use\n"
 		"  --use-pixman\t\tUse the pixman (CPU) renderer\n"
 		"  --current-mode\tPrefer current KMS mode over EDID preferred mode\n\n");
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 1a961389..a9f81fba 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3969,8 +3969,13 @@ drm_backend_create(struct weston_compositor *compositor,
 	struct udev_device *drm_device;
 	struct wl_event_loop *loop;
 	const char *seat_id = default_seat;
+	const char *session_seat;
 	int ret;
 
+	session_seat=getenv("XDG_SEAT");
+	if (session_seat)
+		seat_id=session_seat;
+
 	weston_log("initializing drm backend\n");
 
 	b = zalloc(sizeof *b);
diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 6a305385..dabacbb5 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -723,6 +723,11 @@ 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;
 
 	weston_log("initializing fbdev backend\n");
 
diff --git a/man/weston-drm.man b/man/weston-drm.man
index d7fd5614..28cd6e87 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -94,8 +94,8 @@ switching to the monitor preferred mode.
 \fB\-\-seat\fR=\fIseatid\fR
 Use graphics and input devices designated for seat
 .I seatid
-instead of the default seat
-.BR seat0 .
+instead of the seat defined in
+. BR XDG_SEAT .
 .TP
 \fB\-\-tty\fR=\fIx\fR
 Launch Weston on tty
@@ -117,6 +117,9 @@ The file descriptor (integer) where
 .B weston-launch
 is listening. Automatically set by
 .BR weston-launch .
+.TP
+.B XDG_SEAT
+The seat that Weston will start on.
 .
 .\" ***************************************************************
 .SH "SEE ALSO"
-- 
2.14.1



More information about the wayland-devel mailing list