From 67f0704340b92462cd6cbdee34f96d31c8d9252e Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 16 Dec 2020 00:02:18 +0100 Subject: [PATCH] backends/native: Make device grouping libinput independent Keep device groups as opaque pointers, and just compare those afterwards. Part-of: --- src/backends/native/meta-input-device-native.c | 11 ++++++----- src/backends/native/meta-input-device-native.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c index 76795bd57..df7545ede 100644 --- a/src/backends/native/meta-input-device-native.c +++ b/src/backends/native/meta-input-device-native.c @@ -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); } diff --git a/src/backends/native/meta-input-device-native.h b/src/backends/native/meta-input-device-native.h index 44c31f6ad..841abf1e5 100644 --- a/src/backends/native/meta-input-device-native.h +++ b/src/backends/native/meta-input-device-native.h @@ -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 */