diff --git a/meson.build b/meson.build index 1c005b0..3be9b0b 100644 --- a/meson.build +++ b/meson.build @@ -33,13 +33,17 @@ else endif libevdev = dependency('libevdev') -libinput = dependency('libinput', version: '>=1.21.0') +libinput = dependency('libinput', version: '>=1.21.0', required: false) libxml2 = dependency('libxml-2.0') wayland_protos = dependency('wayland-protocols', version: '>=1.27') wayland_server = dependency('wayland-server', version: '>=1.15') wlroots = dependency(wlroots_version, version: '>=0.17.0') xkbcommon = dependency('xkbcommon') +if libinput.found() + add_project_arguments('-DHAS_LIBINPUT', language: 'c') +endif + msgfmt = find_program('msgfmt', required: false) if msgfmt.found() source_root = meson.current_source_dir() diff --git a/waybox/seat.c b/waybox/seat.c index a927e72..5f9dff1 100644 --- a/waybox/seat.c +++ b/waybox/seat.c @@ -1,7 +1,13 @@ #include #include +#include +#if WLR_HAS_LIBINPUT_BACKEND && defined(HAS_LIBINPUT) #include +#else +#undef HAS_LIBINPUT +#endif +#include #include #include @@ -263,11 +269,14 @@ static void handle_new_keyboard(struct wb_server *server, wl_list_insert(&server->seat->keyboards, &keyboard->link); } +#ifdef HAS_LIBINPUT static bool libinput_config_get_enabled(char *config) { return strcmp(config, "disabled") != 0; } +#endif static void handle_new_pointer(struct wb_server *server, struct wlr_input_device *device) { +#ifdef HAS_LIBINPUT struct wb_config *config = server->config; if (wlr_input_device_is_libinput(device) && config->libinput_config.use_config) { struct libinput_device *libinput_handle = @@ -362,6 +371,7 @@ static void handle_new_pointer(struct wb_server *server, struct wlr_input_device libinput_config_get_enabled(config->libinput_config.tap_drag_lock)); }; } +#endif wlr_cursor_attach_input_device(server->cursor->cursor, device); }