backends/x11: Implement is_grouped for X11

If the devices have a wacom description, compare those. Otherwise,
look up the devices' VID:PID, if they match they should also be
grouped.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
This commit is contained in:
Carlos Garnacho 2020-02-12 20:26:56 +01:00 committed by Carlos Garnacho
parent 3c4f5ddcb4
commit dcaa45fc0c

View File

@ -92,6 +92,30 @@ static gboolean
meta_input_device_x11_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
{
#ifdef HAVE_LIBWACOM
MetaInputDeviceX11 *device_x11 = META_INPUT_DEVICE_X11 (device);
MetaInputDeviceX11 *other_device_x11 = META_INPUT_DEVICE_X11 (other_device);
if (device_x11->wacom_device &&
other_device_x11->wacom_device &&
libwacom_compare (device_x11->wacom_device,
other_device_x11->wacom_device,
WCOMPARE_NORMAL) == 0)
return TRUE;
#endif
if (clutter_input_device_get_vendor_id (device) &&
clutter_input_device_get_product_id (device) &&
clutter_input_device_get_vendor_id (other_device) &&
clutter_input_device_get_product_id (other_device))
{
if (strcmp (clutter_input_device_get_vendor_id (device),
clutter_input_device_get_vendor_id (other_device)) == 0 &&
strcmp (clutter_input_device_get_product_id (device),
clutter_input_device_get_product_id (other_device)) == 0)
return TRUE;
}
return FALSE;
}