[mutter/wip/carlosg/no-event-source: 4/14] clutter: Move away from clutter_event_get_source() in ClutterClickAction




commit a9a55dffd2d83761588658787309c69dd774ccc3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 25 13:02:26 2022 +0100

    clutter: Move away from clutter_event_get_source() in ClutterClickAction
    
    Instead, ask the stage for the device actor, which is equivalent and
    ensured to be up-to-date.

 clutter/clutter/clutter-click-action.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-click-action.c b/clutter/clutter/clutter-click-action.c
index 77193096a1..61ef598b5a 100644
--- a/clutter/clutter/clutter-click-action.c
+++ b/clutter/clutter/clutter-click-action.c
@@ -291,6 +291,7 @@ clutter_click_action_handle_event (ClutterAction      *action,
     clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
   gboolean has_button = TRUE;
   ClutterModifierType modifier_state;
+  ClutterActor *target;
 
   if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
     return CLUTTER_EVENT_PROPAGATE;
@@ -311,7 +312,11 @@ clutter_click_action_handle_event (ClutterAction      *action,
       if (priv->is_held)
         return CLUTTER_EVENT_STOP;
 
-      if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
+      target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
+                                               clutter_event_get_device (event),
+                                               clutter_event_get_event_sequence (event));
+
+      if (!clutter_actor_contains (actor, target))
         return CLUTTER_EVENT_PROPAGATE;
 
       priv->press_button = has_button ? clutter_event_get_button (event) : 0;
@@ -368,7 +373,11 @@ clutter_click_action_handle_event (ClutterAction      *action,
 
       g_clear_handle_id (&priv->long_press_id, g_source_remove);
 
-      if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
+      target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
+                                               clutter_event_get_device (event),
+                                               clutter_event_get_event_sequence (event));
+
+      if (!clutter_actor_contains (actor, target))
         return CLUTTER_EVENT_PROPAGATE;
 
       /* exclude any button-mask so that we can compare


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