[PATCH] libweston: Support autodetection of the current XDG_SEAT

Armin Krezović krezovic.armin at gmail.com
Wed Aug 16 18:06:49 UTC 2017


On 16.08.2017 00:03, nerdopolis wrote:
> On Tuesday, August 15, 2017 3:36:48 PM EDT Armin Krezović wrote:
>> On 15.08.2017 04:02, nerdopolis wrote:
>>
>> Hi,
>>
>>> ---
>>>    libweston/compositor-drm.c   | 5 +++++
>>>    libweston/compositor-fbdev.c | 5 +++++
>>>    2 files changed, 10 insertions(+)
>>>
>>> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
>>> index 10adb463..44b2e448 100644
>>> --- a/libweston/compositor-drm.c
>>> +++ b/libweston/compositor-drm.c
>>> @@ -3502,8 +3502,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;
>>> +
>>
>> seat_id can already be overriden, using --seat=whatever weston option, as seen here:
>>
>> https://cgit.freedesktop.org/wayland/weston/tree/compositor/main.c#n1224
>> https://cgit.freedesktop.org/wayland/weston/tree/libweston/compositor-drm.c#n3549
>>
>> Not sure if there's same thing for fbdev backend, but even if there's not, it should
>> be implemented the same way.
>>
>>>    	weston_log("initializing drm backend\n");
>>>    
>>>    	b = zalloc(sizeof *b);
>>> diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
>>> index e80a5040..81e5ec3b 100644
>>> --- a/libweston/compositor-fbdev.c
>>> +++ b/libweston/compositor-fbdev.c
>>> @@ -712,6 +712,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");
>>>    
>>>
>>
>>
> 
> Hi
> pam_systemd.so sets the XDG_SEAT variable though
> So if you're starting Weston where the session_seat is seat1, weston won't start, unless you specify --seat=$XDG_SEAT
> 
> Which is OK, but then login managers would need to be aware of that when starting Weston
> Thanks
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 


Hi,

Sure, sounds reasonable.

The approach looks correct for at least DRM backend, but coding style
needs to be fixed first, and as Pekka said, a note in the man page
needs to be added.

Thanks.


More information about the wayland-devel mailing list