[mutter/wip/carlosg/input-thread: 8/67] backends/native: Move away from ClutterInputDevice coords




commit 7efed6f1ba43352c703abecfad1ffb257d4d162a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 5 23:43:54 2020 +0200

    backends/native: Move away from ClutterInputDevice coords
    
    Use a new set in MetaInputDeviceNative for the time being.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 src/backends/native/meta-input-device-native.c |  9 +++++++++
 src/backends/native/meta-input-device-native.h |  8 ++++++++
 src/backends/native/meta-seat-native.c         | 17 +++++++++++------
 3 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index 072c80792f..557095dae8 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -1507,3 +1507,12 @@ meta_input_device_native_set_mapping_mode (ClutterInputDevice     *device,
 
   device_native->mapping_mode = mapping;
 }
+
+void
+meta_input_device_native_update_coords (MetaInputDeviceNative *device_native,
+                                        double                 x,
+                                        double                 y)
+{
+  device_native->pointer_x = x;
+  device_native->pointer_y = y;
+}
diff --git a/src/backends/native/meta-input-device-native.h b/src/backends/native/meta-input-device-native.h
index cbc33ce0d1..fa5b3260e4 100644
--- a/src/backends/native/meta-input-device-native.h
+++ b/src/backends/native/meta-input-device-native.h
@@ -76,6 +76,10 @@ struct _MetaInputDeviceNative
   double output_ratio;        /* w:h */
   MetaInputDeviceMapping mapping_mode;
 
+  /* Pointer position */
+  double pointer_x;
+  double pointer_y;
+
   /* Keyboard a11y */
   ClutterKeyboardA11yFlags a11y_flags;
   GList *slow_keys_list;
@@ -137,4 +141,8 @@ void                      meta_input_device_native_a11y_maybe_notify_toggle_keys
 
 struct libinput_device * meta_input_device_native_get_libinput_device (ClutterInputDevice *device);
 
+void                     meta_input_device_native_update_coords (MetaInputDeviceNative *device_native,
+                                                                 double                 x,
+                                                                 double                 y);
+
 #endif /* META_INPUT_DEVICE_NATIVE_H */
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index dc683bb716..60cb0db0cb 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -425,10 +425,14 @@ new_absolute_motion_event (MetaSeatNative     *seat,
 
       clutter_event_set_device_tool (event, device_evdev->last_tool);
       clutter_event_set_device (event, input_device);
+      meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (input_device),
+                                              x, y);
     }
   else
     {
       clutter_event_set_device (event, seat->core_pointer);
+      meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (seat->core_pointer),
+                                              x, y);
     }
 
   if (clutter_input_device_get_device_type (input_device) != CLUTTER_TABLET_DEVICE)
@@ -1098,8 +1102,8 @@ notify_relative_tool_motion (ClutterInputDevice *input_device,
 
   device_evdev = META_INPUT_DEVICE_NATIVE (input_device);
   seat = meta_input_device_native_get_seat (device_evdev);
-  x = input_device->current_x + dx;
-  y = input_device->current_y + dy;
+  x = device_evdev->pointer_x + dx;
+  y = device_evdev->pointer_y + dy;
 
   meta_seat_native_filter_relative_motion (seat,
                                            input_device,
@@ -2501,8 +2505,8 @@ meta_seat_native_constructed (GObject *object)
       CLUTTER_INPUT_MODE_LOGICAL);
   seat->pointer_x = INITIAL_POINTER_X;
   seat->pointer_y = INITIAL_POINTER_Y;
-  _clutter_input_device_set_coords (device, NULL,
-                                    seat->pointer_x, seat->pointer_y);
+  meta_input_device_native_update_coords (META_INPUT_DEVICE_NATIVE (device),
+                                          seat->pointer_x, seat->pointer_y);
   seat->core_pointer = device;
 
   device = meta_input_device_native_new_virtual (
@@ -2840,6 +2844,7 @@ meta_seat_native_query_state (ClutterSeat          *seat,
                               graphene_point_t     *coords,
                               ClutterModifierType  *modifiers)
 {
+  MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
   MetaSeatNative *seat_native = META_SEAT_NATIVE (seat);
 
   if (sequence)
@@ -2867,8 +2872,8 @@ meta_seat_native_query_state (ClutterSeat          *seat,
     {
       if (coords)
         {
-          coords->x = device->current_x;
-          coords->y = device->current_y;
+          coords->x = device_native->pointer_x;
+          coords->y = device_native->pointer_y;
         }
 
       if (modifiers)


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