mirror of
https://github.com/brl/mutter.git
synced 2025-07-03 17:46:31 +00:00
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:

committed by
Georges Basile Stavracas Neto

parent
1c1c8b25ed
commit
e078a007d6
@ -858,6 +858,7 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
|
||||
MetaInputSettingsClass *input_settings_class;
|
||||
MetaInputSettingsPrivate *priv;
|
||||
guint button;
|
||||
gboolean button_lock;
|
||||
|
||||
priv = meta_input_settings_get_instance_private (input_settings);
|
||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||
@ -868,10 +869,11 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
|
||||
/* This key is 'i' in the schema but it also specifies a minimum
|
||||
* range of 0 so the cast here is safe. */
|
||||
button = (guint) g_settings_get_int (priv->trackball_settings, "scroll-wheel-emulation-button");
|
||||
button_lock = g_settings_get_boolean (priv->trackball_settings, "scroll-wheel-emulation-button-lock");
|
||||
|
||||
if (device)
|
||||
{
|
||||
input_settings_class->set_scroll_button (input_settings, device, button);
|
||||
input_settings_class->set_scroll_button (input_settings, device, button, button_lock);
|
||||
}
|
||||
else if (!device)
|
||||
{
|
||||
@ -884,7 +886,7 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
|
||||
device = l->data;
|
||||
|
||||
if (input_settings_class->is_trackball_device (input_settings, device))
|
||||
input_settings_class->set_scroll_button (input_settings, device, button);
|
||||
input_settings_class->set_scroll_button (input_settings, device, button, button_lock);
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
@ -1282,7 +1284,8 @@ meta_input_settings_changed_cb (GSettings *settings,
|
||||
}
|
||||
else if (settings == priv->trackball_settings)
|
||||
{
|
||||
if (strcmp (key, "scroll-wheel-emulation-button") == 0)
|
||||
if (strcmp (key, "scroll-wheel-emulation-button") == 0 ||
|
||||
strcmp (key, "scroll-wheel-emulation-button-lock") == 0)
|
||||
update_trackball_scroll_button (input_settings, NULL);
|
||||
else if (strcmp (key, "accel-profile") == 0)
|
||||
update_pointer_accel_profile (input_settings, settings, NULL);
|
||||
|
Reference in New Issue
Block a user