[PATCH libinput 4/5] tools: hook up drag lock config

Peter Hutterer peter.hutterer at who-t.net
Sun Jun 21 21:54:28 PDT 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 tools/event-debug.c |  7 ++++++-
 tools/shared.c      | 16 ++++++++++++++++
 tools/shared.h      |  1 +
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/event-debug.c b/tools/event-debug.c
index 7aeac06..becde16 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -157,8 +157,13 @@ print_device_notify(struct libinput_event *ev)
 	if (libinput_device_get_size(dev, &w, &h) == 0)
 		printf("\tsize %.2f/%.2fmm", w, h);
 
-	if (libinput_device_config_tap_get_finger_count(dev))
+	if (libinput_device_config_tap_get_finger_count(dev)) {
 	    printf(" tap");
+	    if (libinput_device_config_tap_get_drag_lock_enabled(dev))
+		    printf("(dl on)");
+	    else
+		    printf("(dl off)");
+	}
 	if (libinput_device_config_left_handed_is_available(dev))
 	    printf(" left");
 	if (libinput_device_config_scroll_has_natural_scroll(dev))
diff --git a/tools/shared.c b/tools/shared.c
index 1858c93..0c2f9c4 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -43,6 +43,8 @@ enum options {
 	OPT_VERBOSE,
 	OPT_TAP_ENABLE,
 	OPT_TAP_DISABLE,
+	OPT_DRAG_LOCK_ENABLE,
+	OPT_DRAG_LOCK_DISABLE,
 	OPT_NATURAL_SCROLL_ENABLE,
 	OPT_NATURAL_SCROLL_DISABLE,
 	OPT_LEFT_HANDED_ENABLE,
@@ -75,6 +77,8 @@ tools_usage()
 	       "Features:\n"
 	       "--enable-tap\n"
 	       "--disable-tap.... enable/disable tapping\n"
+	       "--enable-drag-lock\n"
+	       "--disable-drag-lock.... enable/disable tapping drag lock\n"
 	       "--enable-natural-scrolling\n"
 	       "--disable-natural-scrolling.... enable/disable natural scrolling\n"
 	       "--enable-left-handed\n"
@@ -100,6 +104,7 @@ tools_init_options(struct tools_options *options)
 {
 	memset(options, 0, sizeof(*options));
 	options->tapping = -1;
+	options->drag_lock = -1;
 	options->natural_scroll = -1;
 	options->left_handed = -1;
 	options->middlebutton = -1;
@@ -124,6 +129,8 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
 			{ "verbose", 0, 0, OPT_VERBOSE },
 			{ "enable-tap", 0, 0, OPT_TAP_ENABLE },
 			{ "disable-tap", 0, 0, OPT_TAP_DISABLE },
+			{ "enable-drag-lock", 0, 0, OPT_DRAG_LOCK_ENABLE },
+			{ "disable-drag-lock", 0, 0, OPT_DRAG_LOCK_DISABLE },
 			{ "enable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_ENABLE },
 			{ "disable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_DISABLE },
 			{ "enable-left-handed", 0, 0, OPT_LEFT_HANDED_ENABLE },
@@ -168,6 +175,12 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
 			case OPT_TAP_DISABLE:
 				options->tapping = 0;
 				break;
+			case OPT_DRAG_LOCK_ENABLE:
+				options->drag_lock = 1;
+				break;
+			case OPT_DRAG_LOCK_DISABLE:
+				options->drag_lock = 0;
+				break;
 			case OPT_NATURAL_SCROLL_ENABLE:
 				options->natural_scroll = 1;
 				break;
@@ -354,6 +367,9 @@ tools_device_apply_config(struct libinput_device *device,
 {
 	if (options->tapping != -1)
 		libinput_device_config_tap_set_enabled(device, options->tapping);
+	if (options->drag_lock != -1)
+		libinput_device_config_tap_set_drag_lock_enabled(device,
+								 options->drag_lock);
 	if (options->natural_scroll != -1)
 		libinput_device_config_scroll_set_natural_scroll_enabled(device,
 									 options->natural_scroll);
diff --git a/tools/shared.h b/tools/shared.h
index 3ce2e1c..da752d5 100644
--- a/tools/shared.h
+++ b/tools/shared.h
@@ -38,6 +38,7 @@ struct tools_options {
 
 	int verbose;
 	int tapping;
+	int drag_lock;
 	int natural_scroll;
 	int left_handed;
 	int middlebutton;
-- 
2.4.3



More information about the wayland-devel mailing list