[mutter/wip/carlosg/input-thread: 80/91] backends: Do not use clutter_seat_list_devices() in MetaInputSettings
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-thread: 80/91] backends: Do not use clutter_seat_list_devices() in MetaInputSettings
- Date: Tue, 6 Oct 2020 21:13:48 +0000 (UTC)
commit 53c87a8a0f9111f6e4ccf803235d726fedf1a399
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 11 18:10:28 2020 +0200
backends: Do not use clutter_seat_list_devices() in MetaInputSettings
Make it keep its own list of devices, it's not that far off.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
src/backends/meta-input-settings.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 155f9ae032..cc83dddb47 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -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);
}
}
@@ -855,19 +850,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);
}
-
- g_list_free (devices);
}
}
@@ -1585,9 +1576,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);
@@ -1607,6 +1602,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
@@ -1672,12 +1669,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;
@@ -1686,8 +1682,6 @@ check_mappable_devices (MetaInputSettings *input_settings)
check_add_mappable_device (input_settings, device);
}
-
- g_list_free (devices);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]