mirror of
https://github.com/swaywm/sway.git
synced 2024-11-28 10:51:28 +00:00
input/libinput: make udev optional
This commit is contained in:
parent
6c4c0387a2
commit
8600e88728
|
@ -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()
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <float.h>
|
||||
#include <libinput.h>
|
||||
#include <libudev.h>
|
||||
#include <limits.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include "log.h"
|
||||
|
@ -9,6 +8,10 @@
|
|||
#include "sway/input/input-manager.h"
|
||||
#include "sway/ipc-server.h"
|
||||
|
||||
#if HAVE_UDEV
|
||||
#include <libudev.h>
|
||||
#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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue