Add no-op session

This is useful for headless testing, for instance with VKMS:

    modprobe vkms
    export WLR_DRM_DEVICES=/dev/dri/card1
    export WLR_BACKENDS=drm
    export LIBSEAT_BACKEND=noop
    sway

We don't need any of the VT handling in this case.
This commit is contained in:
Simon Ser 2021-03-26 10:05:12 +01:00 committed by Kenny Levinsen
parent 5ad91ae9da
commit 9a7824b7c3
4 changed files with 143 additions and 1 deletions

View file

@ -13,6 +13,7 @@
extern const struct seat_impl seatd_impl;
extern const struct seat_impl logind_impl;
extern const struct seat_impl builtin_impl;
extern const struct seat_impl noop_impl;
static const struct named_backend impls[] = {
#ifdef SEATD_ENABLED
@ -24,6 +25,7 @@ static const struct named_backend impls[] = {
#ifdef BUILTIN_ENABLED
{"builtin", &builtin_impl},
#endif
{"noop", &noop_impl},
{NULL, NULL},
};
@ -62,6 +64,9 @@ struct libseat *libseat_open_seat(struct libseat_seat_listener *listener, void *
struct libseat *backend = NULL;
for (const struct named_backend *iter = impls; iter->backend != NULL; iter++) {
if (iter->backend == &noop_impl) {
continue;
}
backend = iter->backend->open_seat(listener, data);
if (backend != NULL) {
log_infof("Seat opened with backend '%s'", iter->name);