From ec1195e3ff8db6f3888c42d278b3724ec2ca70c0 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 24 Mar 2020 13:16:11 +0100 Subject: [PATCH] backends: Fix configuration changes to tap[-and-drag] Most people just see a harmless warning when applying this setting to all touchpads (which this patch fixes). But tap[-and-drag] is supposed to remain enabled for display-less Wacom tablets, despite configuration changes. Fix this by using the mapping function, so the setting is forced on for wacom devices. This happens on a per-device basis, so the warning is gone too. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1145 --- src/backends/meta-input-settings.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 6d674bbea..7c3afdaff 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -592,6 +592,14 @@ device_is_tablet_touchpad (MetaInputSettings *input_settings, return FALSE; } +static gboolean +force_enable_on_tablet (MetaInputSettings *input_settings, + ClutterInputDevice *device, + gboolean value) +{ + return device_is_tablet_touchpad (input_settings, device) || value; +} + static void update_touchpad_tap_enabled (MetaInputSettings *input_settings, ClutterInputDevice *device) @@ -606,18 +614,19 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings, priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - enabled = device_is_tablet_touchpad (input_settings, device) || - g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); + enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click"); if (device) { + enabled = force_enable_on_tablet (input_settings, device, enabled); settings_device_set_bool_setting (input_settings, device, input_settings_class->set_tap_enabled, enabled); } else { - settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL, + settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, + force_enable_on_tablet, input_settings_class->set_tap_enabled, enabled); } @@ -637,18 +646,19 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings, priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - enabled = device_is_tablet_touchpad (input_settings, device) || - g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); + enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); if (device) { + enabled = force_enable_on_tablet (input_settings, device, enabled); settings_device_set_bool_setting (input_settings, device, input_settings_class->set_tap_and_drag_enabled, enabled); } else { - settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, NULL, + settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, + force_enable_on_tablet, input_settings_class->set_tap_and_drag_enabled, enabled); }