libweston: set the seat automatically based on the XDG_SEAT environment variable

This will allow the seat to be set by the environment as pam_systemd typically
sets the XDG_SEAT variable

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
nerdopolis
2018-06-29 08:17:46 -04:00
committed by Pekka Paalanen
parent efdebbc4e8
commit b16c4ac55b
4 changed files with 16 additions and 7 deletions
+8 -3
View File
@@ -6029,8 +6029,16 @@ 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;
if (config->seat_id)
seat_id = config->seat_id;
weston_log("initializing drm backend\n");
b = zalloc(sizeof *b);
@@ -6062,9 +6070,6 @@ drm_backend_create(struct weston_compositor *compositor,
if (parse_gbm_format(config->gbm_format, GBM_FORMAT_XRGB8888, &b->gbm_format) < 0)
goto err_compositor;
if (config->seat_id)
seat_id = config->seat_id;
/* Check if we run drm-backend using weston-launch */
compositor->launcher = weston_launcher_connect(compositor, config->tty,
seat_id, true);
+2 -1
View File
@@ -106,7 +106,8 @@ struct weston_drm_backend_config {
/** The seat to be used for input and output.
*
* If NULL the default "seat0" will be used. The backend will
* 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.
*/