mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Make libinput optional
Only really useful for wlroots compiled without the libinput backend.
This commit is contained in:
parent
0f9461c4c0
commit
4cf3ee8a05
2 changed files with 15 additions and 1 deletions
|
|
@ -33,13 +33,17 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libevdev = dependency('libevdev')
|
libevdev = dependency('libevdev')
|
||||||
libinput = dependency('libinput', version: '>=1.21.0')
|
libinput = dependency('libinput', version: '>=1.21.0', required: false)
|
||||||
libxml2 = dependency('libxml-2.0')
|
libxml2 = dependency('libxml-2.0')
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.27')
|
wayland_protos = dependency('wayland-protocols', version: '>=1.27')
|
||||||
wayland_server = dependency('wayland-server', version: '>=1.15')
|
wayland_server = dependency('wayland-server', version: '>=1.15')
|
||||||
wlroots = dependency(wlroots_version, version: '>=0.17.0')
|
wlroots = dependency(wlroots_version, version: '>=0.17.0')
|
||||||
xkbcommon = dependency('xkbcommon')
|
xkbcommon = dependency('xkbcommon')
|
||||||
|
|
||||||
|
if libinput.found()
|
||||||
|
add_project_arguments('-DHAS_LIBINPUT', language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
msgfmt = find_program('msgfmt', required: false)
|
msgfmt = find_program('msgfmt', required: false)
|
||||||
if msgfmt.found()
|
if msgfmt.found()
|
||||||
source_root = meson.current_source_dir()
|
source_root = meson.current_source_dir()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
#include <libevdev/libevdev.h>
|
#include <libevdev/libevdev.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <wlr/config.h>
|
||||||
|
#if WLR_HAS_LIBINPUT_BACKEND && defined(HAS_LIBINPUT)
|
||||||
#include <wlr/backend/libinput.h>
|
#include <wlr/backend/libinput.h>
|
||||||
|
#else
|
||||||
|
#undef HAS_LIBINPUT
|
||||||
|
#endif
|
||||||
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/types/wlr_primary_selection.h>
|
#include <wlr/types/wlr_primary_selection.h>
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||||
|
|
||||||
|
|
@ -263,11 +269,14 @@ static void handle_new_keyboard(struct wb_server *server,
|
||||||
wl_list_insert(&server->seat->keyboards, &keyboard->link);
|
wl_list_insert(&server->seat->keyboards, &keyboard->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAS_LIBINPUT
|
||||||
static bool libinput_config_get_enabled(char *config) {
|
static bool libinput_config_get_enabled(char *config) {
|
||||||
return strcmp(config, "disabled") != 0;
|
return strcmp(config, "disabled") != 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void handle_new_pointer(struct wb_server *server, struct wlr_input_device *device) {
|
static void handle_new_pointer(struct wb_server *server, struct wlr_input_device *device) {
|
||||||
|
#ifdef HAS_LIBINPUT
|
||||||
struct wb_config *config = server->config;
|
struct wb_config *config = server->config;
|
||||||
if (wlr_input_device_is_libinput(device) && config->libinput_config.use_config) {
|
if (wlr_input_device_is_libinput(device) && config->libinput_config.use_config) {
|
||||||
struct libinput_device *libinput_handle =
|
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));
|
libinput_config_get_enabled(config->libinput_config.tap_drag_lock));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wlr_cursor_attach_input_device(server->cursor->cursor, device);
|
wlr_cursor_attach_input_device(server->cursor->cursor, device);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue