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




commit 8e89c3ed987198c092490bfbb8c4d899807cff07
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 | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 6101ec5a5d..3d3c4f1fee 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3425,7 +3425,7 @@ clutter_stage_get_device_actor (ClutterStage         *stage,
   return NULL;
 }
 
-static void
+static ClutterEvent *
 create_crossing_event (ClutterStage         *stage,
                        ClutterInputDevice   *device,
                        ClutterEventSequence *sequence,
@@ -3448,14 +3448,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
@@ -3470,6 +3463,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);
 
@@ -3495,20 +3489,24 @@ clutter_stage_update_device (ClutterStage         *stage,
 
       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]