From 7864f26d73aa478a163f801a63f9d6cca4704410 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 19 Dec 2021 16:39:57 +0100 Subject: [PATCH] backend: error out in autocreate without libinput support The libinput backend is now optional. However, this means that a user building wlroots without the correct libinput dependencies will end up with a compositor which doesn't respond to input events. wlr_backend_autocreate is supposed to return a sensible setup, so in this case let's just error out and explain what happened. Users can suppress the check by setting WLR_LIBINPUT_NO_DEVICES=1 (already used to suppress the zero input device case inside the libinput backend). Compositors which really want to create a bare DRM backend can easily create it manually instead of using wlr_backend_autocreate. (cherry picked from commit ec2845750862cc0b175bef59de4305f6da91960a) --- backend/backend.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/backend.c b/backend/backend.c index 24150b13..bfb43ba0 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -364,6 +364,19 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) { return NULL; } wlr_multi_backend_add(backend, libinput); +#else + const char *no_devs = getenv("WLR_LIBINPUT_NO_DEVICES"); + if (no_devs && strcmp(no_devs, "1") == 0) { + wlr_log(WLR_INFO, "WLR_LIBINPUT_NO_DEVICES is set, " + "starting without libinput backend"); + } else { + wlr_log(WLR_ERROR, "libinput support is not compiled in, " + "refusing to start"); + wlr_log(WLR_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check"); + wlr_session_destroy(multi->session); + wlr_backend_destroy(backend); + return NULL; + } #endif #if WLR_HAS_DRM_BACKEND