mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05: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:
parent
1c1c8b25ed
commit
e078a007d6
@ -44,7 +44,7 @@ wayland_server_req = '>= 1.18'
|
|||||||
wayland_protocols_req = '>= 1.19'
|
wayland_protocols_req = '>= 1.19'
|
||||||
|
|
||||||
# native backend version requirements
|
# native backend version requirements
|
||||||
libinput_req = '>= 1.7'
|
libinput_req = '>= 1.15.0'
|
||||||
gbm_req = '>= 17.3'
|
gbm_req = '>= 17.3'
|
||||||
|
|
||||||
# screen cast version requirements
|
# screen cast version requirements
|
||||||
|
@ -78,7 +78,8 @@ struct _MetaInputSettingsClass
|
|||||||
gboolean enabled);
|
gboolean enabled);
|
||||||
void (* set_scroll_button) (MetaInputSettings *settings,
|
void (* set_scroll_button) (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
guint button);
|
guint button,
|
||||||
|
gboolean button_lock);
|
||||||
|
|
||||||
void (* set_click_method) (MetaInputSettings *settings,
|
void (* set_click_method) (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
|
@ -858,6 +858,7 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
|
|||||||
MetaInputSettingsClass *input_settings_class;
|
MetaInputSettingsClass *input_settings_class;
|
||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
guint button;
|
guint button;
|
||||||
|
gboolean button_lock;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (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
|
/* This key is 'i' in the schema but it also specifies a minimum
|
||||||
* range of 0 so the cast here is safe. */
|
* range of 0 so the cast here is safe. */
|
||||||
button = (guint) g_settings_get_int (priv->trackball_settings, "scroll-wheel-emulation-button");
|
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)
|
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)
|
else if (!device)
|
||||||
{
|
{
|
||||||
@ -884,7 +886,7 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
|
|||||||
device = l->data;
|
device = l->data;
|
||||||
|
|
||||||
if (input_settings_class->is_trackball_device (input_settings, device))
|
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);
|
g_list_free (devices);
|
||||||
@ -1282,7 +1284,8 @@ meta_input_settings_changed_cb (GSettings *settings,
|
|||||||
}
|
}
|
||||||
else if (settings == priv->trackball_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);
|
update_trackball_scroll_button (input_settings, NULL);
|
||||||
else if (strcmp (key, "accel-profile") == 0)
|
else if (strcmp (key, "accel-profile") == 0)
|
||||||
update_pointer_accel_profile (input_settings, settings, NULL);
|
update_pointer_accel_profile (input_settings, settings, NULL);
|
||||||
|
@ -270,10 +270,12 @@ meta_input_settings_native_has_two_finger_scroll (MetaInputSettings *settings,
|
|||||||
static void
|
static void
|
||||||
meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
|
meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
guint button)
|
guint button,
|
||||||
|
gboolean button_lock)
|
||||||
{
|
{
|
||||||
struct libinput_device *libinput_device;
|
struct libinput_device *libinput_device;
|
||||||
enum libinput_config_scroll_method method;
|
enum libinput_config_scroll_method method;
|
||||||
|
enum libinput_config_scroll_button_lock_state lock_state;
|
||||||
guint evcode;
|
guint evcode;
|
||||||
|
|
||||||
libinput_device = meta_input_device_native_get_libinput_device (device);
|
libinput_device = meta_input_device_native_get_libinput_device (device);
|
||||||
@ -314,6 +316,13 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
libinput_device_config_scroll_set_button (libinput_device, evcode);
|
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
|
static void
|
||||||
|
@ -375,11 +375,16 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
|
|||||||
static void
|
static void
|
||||||
meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
|
meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
guint button)
|
guint button,
|
||||||
|
gboolean button_lock)
|
||||||
{
|
{
|
||||||
|
gchar lock = button_lock;
|
||||||
|
|
||||||
change_scroll_method (device, SCROLL_METHOD_FIELD_BUTTON, button != 0);
|
change_scroll_method (device, SCROLL_METHOD_FIELD_BUTTON, button != 0);
|
||||||
change_property (device, "libinput Button Scrolling Button",
|
change_property (device, "libinput Button Scrolling Button",
|
||||||
XA_CARDINAL, 32, &button, 1);
|
XA_CARDINAL, 32, &button, 1);
|
||||||
|
change_property (device, "libinput Button Scrolling Button Lock Enabled",
|
||||||
|
XA_INTEGER, 8, &lock, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user