summaryrefslogtreecommitdiff
path: root/tools/shared.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-03-20 10:56:51 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-10-17 12:21:41 +1000
commit63f99230130ae012a71cec90ee0abccb1b43abd3 (patch)
treed07692d299c13e2bab75d05383c8bfa91524f6f2 /tools/shared.c
parent12eb14846a139ae8d4915c338302095a53c69e91 (diff)
downloadlibinput-63f99230130ae012a71cec90ee0abccb1b43abd3.tar.gz
Add a scroll button lock feature
Scroll button locking is an accessibility feature. When enabled, the scroll button does not need to be held down, the first click holds it logically down, to be released on the second click of that same button. This is implemented as simple event filter, so we still get the same behavior from the emulated logical button, i.e. a physical double click results in a single logical click of that button provided no scrolling was triggered. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools/shared.c')
-rw-r--r--tools/shared.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/shared.c b/tools/shared.c
index 8541c595..7dba96dc 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -83,6 +83,7 @@ tools_init_options(struct tools_options *options)
options->click_method = -1;
options->scroll_method = -1;
options->scroll_button = -1;
+ options->scroll_button_lock = -1;
options->speed = 0.0;
options->profile = LIBINPUT_CONFIG_ACCEL_PROFILE_NONE;
}
@@ -198,6 +199,12 @@ tools_parse_option(int option,
return 1;
}
break;
+ case OPT_SCROLL_BUTTON_LOCK_ENABLE:
+ options->scroll_button_lock = true;
+ break;
+ case OPT_SCROLL_BUTTON_LOCK_DISABLE:
+ options->scroll_button_lock = false;
+ break;
case OPT_SPEED:
if (!optarg)
return 1;
@@ -407,6 +414,10 @@ tools_device_apply_config(struct libinput_device *device,
if (options->scroll_button != -1)
libinput_device_config_scroll_set_button(device,
options->scroll_button);
+ if (options->scroll_button_lock != -1)
+ libinput_device_config_scroll_set_button_lock(device,
+ options->scroll_button_lock);
+
if (libinput_device_config_accel_is_available(device)) {
libinput_device_config_accel_set_speed(device,