[mutter/wip/carlosg/dispose-libinput-device: 6/7] backends/native: Make device grouping libinput independent




commit 85f16a67c9f1d8c08c20a8912d37e131726ab355
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 16 00:02:18 2020 +0100

    backends/native: Make device grouping libinput independent
    
    Keep device groups as opaque pointers, and just compare those
    afterwards.

 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 76795bd570..df7545ede3 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 44c31f6adc..841abf1e54 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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]