backends: Map left-handed in tablet "touchpads" together with the tablet

Avoid those devices when applying the configuration to touchpads, and ensure
the devices grouped with the tablet are all synchronized wrt the left handed
setting.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/562
This commit is contained in:
Carlos Garnacho 2019-06-07 12:31:31 +02:00
parent a3b86447f7
commit f82a0a70c0

View File

@ -302,10 +302,31 @@ update_touchpad_left_handed (MetaInputSettings *input_settings,
} }
else else
{ {
settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, GSList *devices, *l;
devices = meta_input_settings_get_devices (input_settings,
CLUTTER_TOUCHPAD_DEVICE);
for (l = devices; l; l = l->next)
{
#ifdef HAVE_LIBWACOM
WacomDevice *wacom_device;
wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
device);
/* "Touchpads" with a wacom description will be rotated along their tablets */
if (wacom_device &&
(libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE))
continue;
#endif
settings_device_set_bool_setting (input_settings, l->data,
input_settings_class->set_left_handed, input_settings_class->set_left_handed,
enabled); enabled);
} }
g_slist_free (devices);
}
} }
static void static void
@ -1068,8 +1089,12 @@ update_tablet_left_handed (MetaInputSettings *input_settings,
ClutterInputDevice *device) ClutterInputDevice *device)
{ {
MetaInputSettingsClass *input_settings_class; MetaInputSettingsClass *input_settings_class;
MetaInputSettingsPrivate *priv;
const GSList *devices, *l;
gboolean enabled; gboolean enabled;
priv = meta_input_settings_get_instance_private (input_settings);
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE && if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE &&
clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE && clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE &&
clutter_input_device_get_device_type (device) != CLUTTER_ERASER_DEVICE && clutter_input_device_get_device_type (device) != CLUTTER_ERASER_DEVICE &&
@ -1091,11 +1116,19 @@ update_tablet_left_handed (MetaInputSettings *input_settings,
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (settings, "left-handed"); enabled = g_settings_get_boolean (settings, "left-handed");
devices = clutter_device_manager_peek_devices (priv->device_manager);
settings_device_set_bool_setting (input_settings, device, for (l = devices; l; l = l->next)
{
if (l->data != device &&
!clutter_input_device_is_grouped (device, l->data))
continue;
settings_device_set_bool_setting (input_settings, l->data,
input_settings_class->set_left_handed, input_settings_class->set_left_handed,
enabled); enabled);
} }
}
static void static void
meta_input_settings_changed_cb (GSettings *settings, meta_input_settings_changed_cb (GSettings *settings,