backends: Do not use clutter_seat_list_devices() in MetaInputSettings

Make it keep its own list of devices, it's not that far off.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
Carlos Garnacho 2020-08-11 18:10:28 +02:00 committed by Marge Bot
parent 2c1558ddbd
commit 4e56352bcc

View File

@ -77,6 +77,7 @@ struct _MetaInputSettingsPrivate
GSettings *keyboard_a11y_settings;
GSettings *mouse_a11y_settings;
GList *devices;
GHashTable *mappable_devices;
GHashTable *current_tools;
@ -115,13 +116,12 @@ meta_input_settings_get_devices (MetaInputSettings *settings,
ClutterInputDeviceType type)
{
MetaInputSettingsPrivate *priv;
GList *l, *devices;
GList *l;
GSList *list = NULL;
priv = meta_input_settings_get_instance_private (settings);
devices = clutter_seat_list_devices (priv->seat);
for (l = devices; l; l = l->next)
for (l = priv->devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
@ -130,8 +130,6 @@ meta_input_settings_get_devices (MetaInputSettings *settings,
list = g_slist_prepend (list, device);
}
g_list_free (devices);
return list;
}
@ -364,10 +362,9 @@ update_pointer_accel_profile (MetaInputSettings *input_settings,
{
MetaInputSettingsPrivate *priv =
meta_input_settings_get_instance_private (input_settings);
GList *l, *devices;
GList *l;
devices = clutter_seat_list_devices (priv->seat);
for (l = devices; l; l = l->next)
for (l = priv->devices; l; l = l->next)
{
device = l->data;
@ -378,8 +375,6 @@ update_pointer_accel_profile (MetaInputSettings *input_settings,
do_update_pointer_accel_profile (input_settings, settings,
device, profile);
}
g_list_free (devices);
}
}
@ -857,19 +852,15 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
}
else if (!device)
{
GList *l, *devices;
GList *l;
devices = clutter_seat_list_devices (priv->seat);
for (l = devices; l; l = l->next)
for (l = priv->devices; l; l = l->next)
{
device = l->data;
if (input_settings_class->is_trackball_device (input_settings, device))
input_settings_class->set_scroll_button (input_settings, device, button, button_lock);
}
g_list_free (devices);
}
}
@ -1588,9 +1579,13 @@ void
meta_input_settings_add_device (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
MetaInputSettingsPrivate *priv =
meta_input_settings_get_instance_private (input_settings);
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_LOGICAL)
return;
priv->devices = g_list_prepend (priv->devices, device);
evaluate_two_finger_scrolling (input_settings, device);
apply_device_settings (input_settings, device);
@ -1610,6 +1605,8 @@ meta_input_settings_remove_device (MetaInputSettings *input_settings,
if (g_hash_table_remove (priv->two_finger_devices, device) &&
g_hash_table_size (priv->two_finger_devices) == 0)
apply_device_settings (input_settings, NULL);
priv->devices = g_list_remove (priv->devices, device);
}
static void
@ -1675,12 +1672,11 @@ static void
check_mappable_devices (MetaInputSettings *input_settings)
{
MetaInputSettingsPrivate *priv;
GList *l, *devices;
GList *l;
priv = meta_input_settings_get_instance_private (input_settings);
devices = clutter_seat_list_devices (priv->seat);
for (l = devices; l; l = l->next)
for (l = priv->devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
@ -1689,8 +1685,6 @@ check_mappable_devices (MetaInputSettings *input_settings)
check_add_mappable_device (input_settings, device);
}
g_list_free (devices);
}
static void