[mutter/wip/carlosg/wacom-tap-fix: 1/2] backends: Add mapping function arg to settings_set_bool_setting()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/wacom-tap-fix: 1/2] backends: Add mapping function arg to settings_set_bool_setting()
- Date: Tue, 24 Mar 2020 14:43:51 +0000 (UTC)
commit 467e02b4898a5e8ce0badc13028989bf0229ea3e
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 23 18:42:11 2020 +0100
backends: Add mapping function arg to settings_set_bool_setting()
This will be useful to actually determine on a per-device basis the
setting being applied, while still doing changes on a per-device-type
basis.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1145
src/backends/meta-input-settings.c | 40 +++++++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 3bee36d41..6d674bbea 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -103,6 +103,10 @@ struct _MetaInputSettingsPrivate
MetaInputMapper *input_mapper;
};
+typedef gboolean (* ConfigBoolMappingFunc) (MetaInputSettings *input_settings,
+ ClutterInputDevice *device,
+ gboolean value);
+
typedef void (*ConfigBoolFunc) (MetaInputSettings *input_settings,
ClutterInputDevice *device,
gboolean setting);
@@ -195,15 +199,22 @@ settings_device_set_bool_setting (MetaInputSettings *input_settings,
static void
settings_set_bool_setting (MetaInputSettings *input_settings,
ClutterInputDeviceType type,
+ ConfigBoolMappingFunc mapping_func,
ConfigBoolFunc func,
gboolean enabled)
{
- GSList *devices, *d;
+ GSList *devices, *l;
devices = meta_input_settings_get_devices (input_settings, type);
- for (d = devices; d; d = d->next)
- settings_device_set_bool_setting (input_settings, d->data, func, enabled);
+ for (l = devices; l; l = l->next)
+ {
+ gboolean value = enabled;
+
+ if (mapping_func)
+ value = mapping_func (input_settings, l->data, value);
+ settings_device_set_bool_setting (input_settings, l->data, func, value);
+ }
g_slist_free (devices);
}
@@ -298,7 +309,7 @@ update_touchpad_left_handed (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL,
input_settings_class->set_left_handed,
enabled);
}
@@ -330,7 +341,7 @@ update_mouse_left_handed (MetaInputSettings *input_settings,
{
GDesktopTouchpadHandedness touchpad_handedness;
- settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE, NULL,
input_settings_class->set_left_handed,
enabled);
@@ -446,7 +457,8 @@ update_middle_click_emulation (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE, func,
+ settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE,
+ NULL, func,
g_settings_get_boolean (settings, key));
}
}
@@ -505,10 +517,12 @@ update_device_natural_scroll (MetaInputSettings *input_settings,
else
{
settings = get_settings_for_device_type (input_settings, CLUTTER_POINTER_DEVICE);
- settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE, func,
+ settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE,
+ NULL, func,
g_settings_get_boolean (settings, key));
settings = get_settings_for_device_type (input_settings, CLUTTER_TOUCHPAD_DEVICE);
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, func,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ NULL, func,
g_settings_get_boolean (settings, key));
}
}
@@ -545,7 +559,7 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL,
input_settings_class->set_disable_while_typing,
enabled);
}
@@ -603,7 +617,7 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL,
input_settings_class->set_tap_enabled,
enabled);
}
@@ -634,7 +648,7 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL,
input_settings_class->set_tap_and_drag_enabled,
enabled);
}
@@ -672,7 +686,7 @@ update_touchpad_edge_scroll (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL,
(ConfigBoolFunc) input_settings_class->set_edge_scroll,
edge_scroll_enabled);
}
@@ -706,7 +720,7 @@ update_touchpad_two_finger_scroll (MetaInputSettings *input_settings,
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
+ settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL,
(ConfigBoolFunc) input_settings_class->set_two_finger_scroll,
two_finger_scroll_enabled);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]