[PATCH 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs

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


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

> ---
>  libweston/launcher-logind.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 

Hi,

I think this patch is good. Logind does everything around VT
management, right? So there is no need to disable something else in
weston as well.

Well, there is one thing I think. This patch makes get_vt() return
zero, and that does not seem to play nice with switch_vt_binding().

Perhaps weston_setup_vt_switch_bindings() should become no-op if
get_vt() return zero?

I suppose all the other launcher implementation could not handle a
non-seat0 seat even if they wanted to? If you could say something
about that, it would be nice, if not, don't worry.

> diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
> index a069bd4f..11627590 100644
> --- a/libweston/launcher-logind.c
> +++ b/libweston/launcher-logind.c
> @@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, struct weston_compositor *
>  		free(t);
>  		goto err_session;
>  	}
> -	free(t);
>  
> -	r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
> -	if (r < 0) {
> -		weston_log("logind: session not running on a VT\n");
> -		goto err_session;
> -	} else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> -		weston_log("logind: requested VT --tty=%d differs from real session VT %u\n",
> -			   tty, wl->vtnr);
> -		r = -EINVAL;
> -		goto err_session;
> +        if (!strcmp(t, "seat0")) {

Use tabs for indentation.

> +		r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
> +		if (r < 0) {
> +			weston_log("logind: session not running on a VT\n");
> +			goto err_session;
> +		} else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> +			weston_log("logind: requested VT --tty=%d differs from real session VT %u\n",
> +				   tty, wl->vtnr);
> +			r = -EINVAL;
> +			goto err_session;
> +		}
>  	}
> +	free(t);
>  
>  	loop = wl_display_get_event_loop(compositor->wl_display);
>  	r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);


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/f69ec863/attachment.sig>


More information about the wayland-devel mailing list