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

Pekka Paalanen ppaalanen at gmail.com
Tue Sep 26 13:17:37 UTC 2017


On Wed,  6 Sep 2017 08:17:18 -0400
nerdopolis <bluescreen_avenger at verizon.net> wrote:

> ---

Hi,

the commit message should contain at least briefly why we want this. I
have a feeling this is the right thing to do, but I can't quite put the
reason into words myself.

We would also prefer a Signed-off-by line in all patches, with your
real name and email.

>  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;

Needs spaces around operators.

> +
>  	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;

Spaces around operators.

>  
>  	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 .

Would be nice to mention it is a environment variable, and if it is not
set, then falling back to "seat0".

>  .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"

It is very nice to remember to update the manuals. :-)

A nice improvement. I think this patch should be split: one patch for
DRM-backend, another fbdev-backend, especially as this patch does not
actually make fbdev backend use XDG_SEAT - it's the next patch that
does.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170926/b648ed66/attachment.sig>


More information about the wayland-devel mailing list