diff --git a/tools/event-debug.c b/tools/event-debug.c index b8be215d..ffc9a132 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -261,13 +261,6 @@ print_touch_event_with_coords(struct libinput_event *ev) xmm, ymm); } -static void -setup_device(struct libinput_device *device) -{ - if (options.tapping != -1) - libinput_device_config_tap_set_enabled(device, options.tapping); -} - static int handle_and_print_events(struct libinput *li) { @@ -284,7 +277,8 @@ handle_and_print_events(struct libinput *li) case LIBINPUT_EVENT_DEVICE_ADDED: case LIBINPUT_EVENT_DEVICE_REMOVED: print_device_notify(ev); - setup_device(libinput_event_get_device(ev)); + tools_device_apply_config(libinput_event_get_device(ev), + &options); break; case LIBINPUT_EVENT_KEYBOARD_KEY: print_key_event(ev); diff --git a/tools/shared.c b/tools/shared.c index f8ceb341..bd8fd11b 100644 --- a/tools/shared.c +++ b/tools/shared.c @@ -222,3 +222,11 @@ tools_open_backend(struct tools_options *options, return li; } + +void +tools_device_apply_config(struct libinput_device *device, + struct tools_options *options) +{ + if (options->tapping != -1) + libinput_device_config_tap_set_enabled(device, options->tapping); +} diff --git a/tools/shared.h b/tools/shared.h index 04d13697..71a3b360 100644 --- a/tools/shared.h +++ b/tools/shared.h @@ -43,7 +43,8 @@ void tools_init_options(struct tools_options *options); int tools_parse_args(int argc, char **argv, struct tools_options *options); struct libinput* tools_open_backend(struct tools_options *options, const struct libinput_interface *interface); - +void tools_device_apply_config(struct libinput_device *device, + struct tools_options *options); void tools_usage(); #endif