From 8600e88728092b6f48a6f55fc9d85564e3c6d88c Mon Sep 17 00:00:00 2001 From: illiliti Date: Wed, 9 Feb 2022 15:17:22 +0300 Subject: [PATCH] input/libinput: make udev optional --- meson.build | 3 ++- meson_options.txt | 1 + sway/input/libinput.c | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 5bedeb2e..ee8a35e5 100644 --- a/meson.build +++ b/meson.build @@ -64,7 +64,7 @@ libinput = dependency('libinput', version: '>=1.6.0') xcb = dependency('xcb', required: get_option('xwayland')) drm_full = dependency('libdrm') # only needed for drm_fourcc.h drm = drm_full.partial_dependency(compile_args: true, includes: true) -libudev = dependency('libudev') +libudev = dependency('libudev', required: get_option('udev')) bash_comp = dependency('bash-completion', required: false) fish_comp = dependency('fish', required: false) math = cc.find_library('m') @@ -113,6 +113,7 @@ conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu') conf_data.set10('HAVE_TRAY', have_tray) +conf_data.set10('HAVE_UDEV', libudev.found()) scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) if scdoc.found() diff --git a/meson_options.txt b/meson_options.txt index 6ba67554..435fc28b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -9,3 +9,4 @@ option('tray', type: 'feature', value: 'auto', description: 'Enable support for option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybg') option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus library') +option('udev', type: 'feature', value: 'auto', description: 'Enable support for udev') diff --git a/sway/input/libinput.c b/sway/input/libinput.c index 3c0f359d..28b57273 100644 --- a/sway/input/libinput.c +++ b/sway/input/libinput.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include "log.h" @@ -9,6 +8,10 @@ #include "sway/input/input-manager.h" #include "sway/ipc-server.h" +#if HAVE_UDEV +#include +#endif + static void log_status(enum libinput_config_status status) { if (status != LIBINPUT_CONFIG_STATUS_SUCCESS) { sway_log(SWAY_ERROR, "Failed to apply libinput config: %s", @@ -315,6 +318,7 @@ void sway_input_reset_libinput_device(struct sway_input_device *input_device) { } bool sway_libinput_device_is_builtin(struct sway_input_device *sway_device) { +#if HAVE_UDEV if (!wlr_input_device_is_libinput(sway_device->wlr_device)) { return false; } @@ -341,4 +345,7 @@ bool sway_libinput_device_is_builtin(struct sway_input_device *sway_device) { const char infix_platform[] = "-platform-"; return (strncmp(id_path, prefix_pci, strlen(prefix_pci)) == 0) && strstr(id_path, infix_platform); +#else + return false; +#endif }