backends: Use capabilities to figure out trackballs in MetaInputSettings

Port these configuration methods to use capabilities, instead of using the
internal vfunc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
This commit is contained in:
Carlos Garnacho 2022-09-06 10:20:21 +02:00 committed by Marge Bot
parent 5471b866b3
commit 46643b895c

View File

@ -930,12 +930,18 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
MetaInputSettingsPrivate *priv;
guint button;
gboolean button_lock;
ClutterInputCapabilities caps;
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
if (device && !input_settings_class->is_trackball_device (input_settings, device))
return;
if (device)
{
caps = clutter_input_device_get_capabilities (device);
if ((caps & CLUTTER_INPUT_CAPABILITY_TRACKBALL) == 0)
return;
}
/* This key is 'i' in the schema but it also specifies a minimum
* range of 0 so the cast here is safe. */
@ -953,8 +959,9 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
for (l = priv->devices; l; l = l->next)
{
device = l->data;
caps = clutter_input_device_get_capabilities (device);
if (input_settings_class->is_trackball_device (input_settings, device))
if ((caps & CLUTTER_INPUT_CAPABILITY_TRACKBALL) != 0)
input_settings_class->set_scroll_button (input_settings, device, button, button_lock);
}
}