tools: move applying device configuration to shared lib
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 18 Dec 2014 05:10:09 +0000 (15:10 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 23 Dec 2014 00:50:31 +0000 (10:50 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/event-debug.c
tools/shared.c
tools/shared.h

index b8be215..ffc9a13 100644 (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);
index f8ceb34..bd8fd11 100644 (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);
+}
index 04d1369..71a3b36 100644 (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