diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-11-22 14:52:14 +0100 |
---|---|---|
committer | Pekka Paalanen <pq@iki.fi> | 2021-04-14 09:22:17 +0000 |
commit | 97d421a7e8103866b2eb69b2f5aac33054f5518d (patch) | |
tree | 7fc6d1bed5e1486df33e1b30273c0987922f4a30 | |
parent | 6c4a993a999048a2054ec97e71d32839b312c642 (diff) | |
download | weston-97d421a7e8103866b2eb69b2f5aac33054f5518d.tar.gz |
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>
-rw-r--r-- | libweston/launcher-logind.c | 3 | ||||
-rw-r--r-- | libweston/launcher-util.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c index 580bb226..993d8e1a 100644 --- a/libweston/launcher-logind.c +++ b/libweston/launcher-logind.c @@ -860,6 +860,9 @@ static int launcher_logind_get_vt(struct weston_launcher *launcher) { struct launcher_logind *wl = wl_container_of(launcher, wl, base); + if (wl->vtnr <= 0) { + return -EINVAL; + } return wl->vtnr; } diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c index 058b6ac0..b2219b68 100644 --- a/libweston/launcher-util.c +++ b/libweston/launcher-util.c @@ -31,6 +31,7 @@ #include "launcher-util.h" #include "launcher-impl.h" +#include <errno.h> #include <stdint.h> #include <unistd.h> #include <linux/input.h> @@ -107,10 +108,12 @@ switch_vt_binding(struct weston_keyboard *keyboard, WL_EXPORT void weston_setup_vt_switch_bindings(struct weston_compositor *compositor) { + int ret; uint32_t key; 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; if (compositor->vt_switching == false) |