[PATCH libinput 5/8] tools: move applying device configuration to shared lib

Peter Hutterer peter.hutterer at who-t.net
Thu Dec 18 15:16:20 PST 2014


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/event-debug.c | 10 ++--------
 tools/shared.c      |  8 ++++++++
 tools/shared.h      |  3 ++-
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/event-debug.c b/tools/event-debug.c
index b8be215..ffc9a13 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 f8ceb34..bd8fd11 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 04d1369..71a3b36 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
-- 
2.1.0



More information about the wayland-devel mailing list