[mutter/wip/carlosg/unthrottled-wayland: 19/21] clutter/stage: Update stored pointer coordinates in fast paths




commit d129cc63410eab0a07a95593f8b5663694647e1b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Aug 25 16:37:23 2021 +0200

    clutter/stage: Update stored pointer coordinates in fast paths
    
    If we are still under the "clear area" of the pick actor, we forget
    to update the coordinates. This is usually not needed, unless we
    need to repick again for non-event circumstances (e.g. pick actor
    is destroyed). This will ensure the right pointer coordinates are
    used afterwards in those situations.

 clutter/clutter/clutter-stage.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index e62dfb8061..e0d8b2a867 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3651,6 +3651,24 @@ clutter_stage_get_device_coords (ClutterStage         *stage,
     *coords = entry->coords;
 }
 
+static void
+clutter_stage_set_device_coords (ClutterStage         *stage,
+                                 ClutterInputDevice   *device,
+                                 ClutterEventSequence *sequence,
+                                 graphene_point_t      coords)
+{
+  ClutterStagePrivate *priv = stage->priv;
+  PointerDeviceEntry *entry = NULL;
+
+  if (sequence != NULL)
+    entry = g_hash_table_lookup (priv->touch_sequences, sequence);
+  else
+    entry = g_hash_table_lookup (priv->pointer_devices, device);
+
+  if (entry)
+    entry->coords = coords;
+}
+
 static void
 create_crossing_event (ClutterStage         *stage,
                        ClutterInputDevice   *device,
@@ -3798,7 +3816,11 @@ clutter_stage_pick_and_update_device (ClutterStage             *stage,
     {
       if (clutter_stage_check_in_clear_area (stage, device,
                                              sequence, point))
-        return clutter_stage_get_device_actor (stage, device, sequence);
+        {
+          clutter_stage_set_device_coords (stage, device,
+                                           sequence, point);
+          return clutter_stage_get_device_actor (stage, device, sequence);
+        }
     }
 
   new_actor = _clutter_stage_do_pick (stage,


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