tools: move applying device configuration to shared lib

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-12-18 15:10:09 +10:00
parent 3628f7016e
commit b8e63b54d3
3 changed files with 12 additions and 9 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -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