backends: add support for scroll button locking

Where enabled, the first click of the scroll button sets the button logically
down, the second click sets the button logically up.

This is an accessibility feature, it doesn't require users to keep holding the
button down while scrolling which is hard or impossible for some users.

gsettings-desktop-schemas merge request:
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/-/merge_requests/39

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1432
This commit is contained in:
Peter Hutterer
2020-09-08 11:08:05 +10:00
committed by Georges Basile Stavracas Neto
parent 1c1c8b25ed
commit e078a007d6
5 changed files with 25 additions and 7 deletions

View File

@ -270,10 +270,12 @@ meta_input_settings_native_has_two_finger_scroll (MetaInputSettings *settings,
static void
meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
ClutterInputDevice *device,
guint button)
guint button,
gboolean button_lock)
{
struct libinput_device *libinput_device;
enum libinput_config_scroll_method method;
enum libinput_config_scroll_button_lock_state lock_state;
guint evcode;
libinput_device = meta_input_device_native_get_libinput_device (device);
@ -314,6 +316,13 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
return;
libinput_device_config_scroll_set_button (libinput_device, evcode);
if (button_lock)
lock_state = LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED;
else
lock_state = LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED;
libinput_device_config_scroll_set_button_lock (libinput_device, lock_state);
}
static void