[mutter/wip/carlosg/fix-pad-osds-position: 139/140] backends/x11: Implement is_grouped for X11
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/fix-pad-osds-position: 139/140] backends/x11: Implement is_grouped for X11
- Date: Wed, 12 Feb 2020 19:40:36 +0000 (UTC)
commit 143964ed40acbee3a4b0b9a3eeb41f50febf2f6e
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 12 20:26:56 2020 +0100
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
src/backends/x11/meta-input-device-x11.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
---
diff --git a/src/backends/x11/meta-input-device-x11.c b/src/backends/x11/meta-input-device-x11.c
index 26a40620f..fcfeb6392 100644
--- a/src/backends/x11/meta-input-device-x11.c
+++ b/src/backends/x11/meta-input-device-x11.c
@@ -92,6 +92,31 @@ 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))
+ return TRUE;
+#endif
+
+ /* Devices with the same VID:PID get grouped together */
+ 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]