launcher: do not touch VT/tty while using non-default seat

Launcher-direct does not allow us to run using a different
seat from the default seat0. This happens because VTs are
only exposed to the default seat, and users that are on
non-default seat should not touch VTs.

Add check in launcher-direct to skip VT/tty management if user
is running on a non-default seat.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2020-06-03 10:01:06 -03:00 committed by Pekka Paalanen
parent 77d06f7b8b
commit 887a7e5717
1 changed files with 11 additions and 7 deletions

View File

@ -301,9 +301,13 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
launcher->base.iface = &launcher_direct_iface;
launcher->compositor = compositor;
if (setup_tty(launcher, tty) == -1) {
free(launcher);
return -1;
if (strcmp("seat0", seat_id) == 0) {
if (setup_tty(launcher, tty) == -1) {
free(launcher);
return -1;
}
} else {
launcher->tty = -1;
}
* (struct launcher_direct **) out = launcher;
@ -315,11 +319,11 @@ launcher_direct_destroy(struct weston_launcher *launcher_base)
{
struct launcher_direct *launcher = wl_container_of(launcher_base, launcher, base);
launcher_direct_restore(&launcher->base);
wl_event_source_remove(launcher->vt_source);
if (launcher->tty >= 0)
if (launcher->tty >= 0) {
launcher_direct_restore(&launcher->base);
wl_event_source_remove(launcher->vt_source);
close(launcher->tty);
}
free(launcher);
}