[mutter/wip/carlosg/grabs-pt1: 88/93] clutter: Only emit regular crossing events in the actors they make sense




commit 575b88a86ec583eb709718a261f8dc31641787f9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 27 18:14:22 2021 +0200

    clutter: Only emit regular crossing events in the actors they make sense
    
    Instead of propagating ENTER/LEAVE all the way from the stage, emit those
    events only in the actors that are actually entered or left.

 clutter/clutter/clutter-stage.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index f1e8c4a4fb..6f1c62f6f9 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3526,7 +3526,7 @@ clutter_stage_update_device (ClutterStage         *stage,
                              gboolean              emit_crossing)
 {
   ClutterInputDeviceType device_type;
-  ClutterActor *old_actor;
+  ClutterActor *old_actor, *root;
   gboolean device_actor_changed;
   ClutterEvent *event;
 
@@ -3553,6 +3553,18 @@ clutter_stage_update_device (ClutterStage         *stage,
                     point.y,
                     _clutter_actor_get_debug_name (new_actor));
 
+      if (emit_crossing)
+        {
+          ClutterActor *grab_actor;
+
+          grab_actor = clutter_stage_get_grab_actor (stage);
+
+          if (grab_actor)
+            root = grab_actor;
+          else
+            root = common_root_actor (stage, new_actor, old_actor);
+        }
+
       /* we need to make sure that this event is processed
        * before any other event we might have queued up until
        * now, so we go on, and synthesize the event emission
@@ -3566,7 +3578,8 @@ clutter_stage_update_device (ClutterStage         *stage,
                                          old_actor, new_actor,
                                          point, time_ms);
           if (!_clutter_event_process_filters (event))
-            _clutter_process_event (event);
+            _clutter_actor_handle_event (old_actor, root, event);
+
           clutter_event_free (event);
         }
 
@@ -3578,7 +3591,8 @@ clutter_stage_update_device (ClutterStage         *stage,
                                          new_actor, old_actor,
                                          point, time_ms);
           if (!_clutter_event_process_filters (event))
-            _clutter_process_event (event);
+            _clutter_actor_handle_event (new_actor, root, event);
+
           clutter_event_free (event);
         }
     }


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