backends: Always enable tap-to-click/drag on opaque Wacom tablets

Touch-wise, those are essentially giant touchpads, but have no buttons
associated to the "touchpad" device (There may be pad buttons, but
those are not mouse buttons).

Without tap-to-click/drag, touch in those devices is somewhat useless
out of the box. Have them always enable these features, despite the
setting.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/968
This commit is contained in:
Carlos Garnacho 2019-12-12 18:05:08 +01:00 committed by Georges Basile Stavracas Neto
parent a8cb84c711
commit 1e7285b2bb

View File

@ -517,6 +517,33 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
} }
} }
static gboolean
device_is_tablet_touchpad (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
#ifdef HAVE_LIBWACOM
WacomIntegrationFlags flags = 0;
WacomDevice *wacom_device;
if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return FALSE;
wacom_device =
meta_input_settings_get_tablet_wacom_device (input_settings,
device);
if (wacom_device)
{
flags = libwacom_get_integration_flags (wacom_device);
if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
return TRUE;
}
#endif
return FALSE;
}
static void static void
update_touchpad_tap_enabled (MetaInputSettings *input_settings, update_touchpad_tap_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device) ClutterInputDevice *device)
@ -531,7 +558,8 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings); priv = meta_input_settings_get_instance_private (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 (priv->touchpad_settings, "tap-to-click"); enabled = device_is_tablet_touchpad (input_settings, device) ||
g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
if (device) if (device)
{ {
@ -561,7 +589,8 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings); priv = meta_input_settings_get_instance_private (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 (priv->touchpad_settings, "tap-and-drag"); enabled = device_is_tablet_touchpad (input_settings, device) ||
g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
if (device) if (device)
{ {