libweston/launcher: Allow VT switch without get_vt

get_vt is used to check if VTs are enabled, by verifying that a VT greater than
0 is returned.

libseat always implements switching, with switch to an active session
currently being a noop in all backends. libseat does not currently have
a get_vt implementation. Make get_vt errors more explicit, and allow VT
switching anyway if the error is ENOSYS.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
dev
Kenny Levinsen 4 years ago committed by Pekka Paalanen
parent 6c4a993a99
commit 97d421a7e8
  1. 3
      libweston/launcher-logind.c
  2. 5
      libweston/launcher-util.c

@ -860,6 +860,9 @@ static int
launcher_logind_get_vt(struct weston_launcher *launcher) launcher_logind_get_vt(struct weston_launcher *launcher)
{ {
struct launcher_logind *wl = wl_container_of(launcher, wl, base); struct launcher_logind *wl = wl_container_of(launcher, wl, base);
if (wl->vtnr <= 0) {
return -EINVAL;
}
return wl->vtnr; return wl->vtnr;
} }

@ -31,6 +31,7 @@
#include "launcher-util.h" #include "launcher-util.h"
#include "launcher-impl.h" #include "launcher-impl.h"
#include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <linux/input.h> #include <linux/input.h>
@ -107,10 +108,12 @@ switch_vt_binding(struct weston_keyboard *keyboard,
WL_EXPORT void WL_EXPORT void
weston_setup_vt_switch_bindings(struct weston_compositor *compositor) weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
{ {
int ret;
uint32_t key; uint32_t key;
struct weston_launcher *launcher = compositor->launcher; struct weston_launcher *launcher = compositor->launcher;
if (launcher->iface->get_vt(launcher) <= 0) ret = launcher->iface->get_vt(launcher);
if (ret < 0 && ret != -ENOSYS)
return; return;
if (compositor->vt_switching == false) if (compositor->vt_switching == false)

Loading…
Cancel
Save