diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-01-22 17:59:19 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-01-27 10:03:28 +1000 |
commit | cba2278c3ab3479f8805f04dc7e80a8356e1d54d (patch) | |
tree | f6c650c9bd668db7c91c0e9c2b943874147fd51e /tools | |
parent | f8bcbc2dbb8cbbd5f1dea614238fcaa0c4cb2da0 (diff) | |
download | libinput-cba2278c3ab3479f8805f04dc7e80a8356e1d54d.tar.gz |
touchpad: add a config option to disable tap-and-drag
There are a number of use-cases where tapping may be desirable, but
tap-and-drag is not, e.g. where tapping is used to select multiple items in a
list. Having tap-and-drag on hinders this, and the nature of the interaction
means it cannot be detected based on timeouts, movement thresholds, etc.
Provide an option instead to turn tap-an-drag off. Tap-and-drag remains
enabled by default (though tapping is disabled by default).
For the touchpad tap state diagram, the new option disables the transition
from state TOUCH to state TAPPED and releases the button immediately instead.
This means that multitap-and-drag is disabled too since we now just loop
around in the single-tap state for multitap.
It also makes tapping more responsive - we don't have to wait for the timeout
before we know whether it's a tap event. The first touch time is noted, we now
send the button press with the time of the first touch and the release with
the time of the release. This ensures a realistic time diff between the two
events.
https://bugs.freedesktop.org/show_bug.cgi?id=93502
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.netto>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libinput-list-devices.c | 13 | ||||
-rw-r--r-- | tools/shared.c | 16 | ||||
-rw-r--r-- | tools/shared.h | 1 |
3 files changed, 30 insertions, 0 deletions
diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c index 21685d9b..96c5b0d8 100644 --- a/tools/libinput-list-devices.c +++ b/tools/libinput-list-devices.c @@ -48,6 +48,18 @@ tap_default(struct libinput_device *device) } static const char * +drag_default(struct libinput_device *device) +{ + if (!libinput_device_config_tap_get_finger_count(device)) + return "n/a"; + + if (libinput_device_config_tap_get_default_drag_enabled(device)) + return "enabled"; + else + return "disabled"; +} + +static const char * draglock_default(struct libinput_device *device) { if (!libinput_device_config_tap_get_finger_count(device)) @@ -260,6 +272,7 @@ print_device_notify(struct libinput_event *ev) printf("\n"); printf("Tap-to-click: %s\n", tap_default(dev)); + printf("Tap-and-drag: %s\n", drag_default(dev)); printf("Tap drag lock: %s\n", draglock_default(dev)); printf("Left-handed: %s\n", left_handed_default(dev)); printf("Nat.scrolling: %s\n", nat_scroll_default(dev)); diff --git a/tools/shared.c b/tools/shared.c index 5fe5862c..29af9ef5 100644 --- a/tools/shared.c +++ b/tools/shared.c @@ -45,6 +45,8 @@ enum options { OPT_VERBOSE, OPT_TAP_ENABLE, OPT_TAP_DISABLE, + OPT_DRAG_ENABLE, + OPT_DRAG_DISABLE, OPT_DRAG_LOCK_ENABLE, OPT_DRAG_LOCK_DISABLE, OPT_NATURAL_SCROLL_ENABLE, @@ -82,6 +84,8 @@ tools_usage() "Features:\n" "--enable-tap\n" "--disable-tap.... enable/disable tapping\n" + "--enable-drag\n" + "--disable-drag.... enable/disable tap-n-drag\n" "--enable-drag-lock\n" "--disable-drag-lock.... enable/disable tapping drag lock\n" "--enable-natural-scrolling\n" @@ -117,6 +121,7 @@ tools_init_context(struct tools_context *context) memset(options, 0, sizeof(*options)); options->tapping = -1; + options->drag = -1; options->drag_lock = -1; options->natural_scroll = -1; options->left_handed = -1; @@ -147,6 +152,8 @@ tools_parse_args(int argc, char **argv, struct tools_context *context) { "verbose", 0, 0, OPT_VERBOSE }, { "enable-tap", 0, 0, OPT_TAP_ENABLE }, { "disable-tap", 0, 0, OPT_TAP_DISABLE }, + { "enable-drag", 0, 0, OPT_DRAG_ENABLE }, + { "disable-drag", 0, 0, OPT_DRAG_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 }, @@ -199,6 +206,12 @@ tools_parse_args(int argc, char **argv, struct tools_context *context) case OPT_TAP_DISABLE: options->tapping = 0; break; + case OPT_DRAG_ENABLE: + options->drag = 1; + break; + case OPT_DRAG_DISABLE: + options->drag = 0; + break; case OPT_DRAG_LOCK_ENABLE: options->drag_lock = 1; break; @@ -438,6 +451,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 != -1) + libinput_device_config_tap_set_drag_enabled(device, + options->drag); if (options->drag_lock != -1) libinput_device_config_tap_set_drag_lock_enabled(device, options->drag_lock); diff --git a/tools/shared.h b/tools/shared.h index 0065fcc0..14ed9ccb 100644 --- a/tools/shared.h +++ b/tools/shared.h @@ -39,6 +39,7 @@ struct tools_options { int verbose; int tapping; + int drag; int drag_lock; int natural_scroll; int left_handed; |