backends/native: Make device grouping libinput independent

Keep device groups as opaque pointers, and just compare those
afterwards.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1639>
This commit is contained in:
Carlos Garnacho 2020-12-16 00:02:18 +01:00
parent 96070e820c
commit 67f0704340
2 changed files with 7 additions and 5 deletions

View File

@ -172,13 +172,12 @@ static gboolean
meta_input_device_native_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
{
struct libinput_device *libinput_device, *other_libinput_device;
MetaInputDeviceNative *device_native, *other_device_native;
libinput_device = meta_input_device_native_get_libinput_device (device);
other_libinput_device = meta_input_device_native_get_libinput_device (other_device);
device_native = META_INPUT_DEVICE_NATIVE (device);
other_device_native = META_INPUT_DEVICE_NATIVE (other_device);
return libinput_device_get_device_group (libinput_device) ==
libinput_device_get_device_group (other_libinput_device);
return device_native->group == other_device_native->group;
}
static int
@ -1395,6 +1394,8 @@ meta_input_device_native_new_in_impl (MetaSeatImpl *seat_impl,
if (libinput_device_get_size (libinput_device, &width, &height) == 0)
device->device_aspect_ratio = width / height;
device->group = (intptr_t) libinput_device_get_device_group (libinput_device);
return CLUTTER_INPUT_DEVICE (device);
}

View File

@ -77,6 +77,7 @@ struct _MetaInputDeviceNative
ClutterInputDeviceTool *last_tool;
GArray *pad_features;
GArray *modes;
intptr_t group;
cairo_matrix_t device_matrix;
double device_aspect_ratio; /* w:h */