[mutter/wip/carlosg/grabs-pt1: 5/13] clutter: Separate crossing event creation from emission




commit a0e2a778e2a07fece21e56d2e938631407f63d63
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Oct 26 16:51:01 2021 +0200

    clutter: Separate crossing event creation from emission
    
    We will want to be more specific about the portions of the actor
    hierarchy that receive this event, separate creation and emission
    so each place does what is relevant.
    
    However, this commit brings no functional changes.

 clutter/clutter/clutter-stage.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 2c0390b186..70feaf0bcf 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3426,7 +3426,7 @@ clutter_stage_get_device_actor (ClutterStage         *stage,
   return NULL;
 }
 
-static void
+static ClutterEvent *
 create_crossing_event (ClutterStage         *stage,
                        ClutterInputDevice   *device,
                        ClutterEventSequence *sequence,
@@ -3449,14 +3449,7 @@ create_crossing_event (ClutterStage         *stage,
   event->crossing.sequence = sequence;
   clutter_event_set_device (event, device);
 
-  /* 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
-   * ourselves
-   */
-  _clutter_process_event (event);
-
-  clutter_event_free (event);
+  return event;
 }
 
 void
@@ -3471,6 +3464,7 @@ clutter_stage_update_device (ClutterStage         *stage,
   ClutterInputDeviceType device_type;
   ClutterActor *old_actor;
   gboolean device_actor_changed;
+  ClutterEvent *event;
 
   device_type = clutter_input_device_get_device_type (device);
 
@@ -3494,22 +3488,31 @@ clutter_stage_update_device (ClutterStage         *stage,
                     point.y,
                     _clutter_actor_get_debug_name (new_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
+       * ourselves
+       */
       if (old_actor && emit_crossing)
         {
-          create_crossing_event (stage,
-                                 device, sequence,
-                                 CLUTTER_LEAVE,
-                                 old_actor, new_actor,
-                                 point, time);
+          event = create_crossing_event (stage,
+                                         device, sequence,
+                                         CLUTTER_LEAVE,
+                                         old_actor, new_actor,
+                                         point, time);
+          _clutter_process_event (event);
+          clutter_event_free (event);
         }
 
       if (new_actor && emit_crossing)
         {
-          create_crossing_event (stage,
-                                 device, sequence,
-                                 CLUTTER_ENTER,
-                                 new_actor, old_actor,
-                                 point, time);
+          event = create_crossing_event (stage,
+                                         device, sequence,
+                                         CLUTTER_ENTER,
+                                         new_actor, old_actor,
+                                         point, time);
+          _clutter_process_event (event);
+          clutter_event_free (event);
         }
     }
 }


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