[mutter/wip/carlosg/grabs-pt1: 24/30] clutter: Only emit regular crossing events in the actors they make sense
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/grabs-pt1: 24/30] clutter: Only emit regular crossing events in the actors they make sense
- Date: Fri, 29 Oct 2021 16:29:17 +0000 (UTC)
commit 4417fff5029df30899cf190b00e8ebe7d7a16ca3
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 | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index d5b483d672..7c980e5fa4 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3453,6 +3453,24 @@ common_root_actor (ClutterStage *stage,
return CLUTTER_ACTOR (stage);
}
+static ClutterActor *
+next_after_root (ClutterStage *stage,
+ ClutterActor *root,
+ ClutterActor *actor)
+{
+ while (actor)
+ {
+ ClutterActor *parent;
+
+ parent = clutter_actor_get_parent (actor);
+ if (parent == root)
+ return actor;
+ actor = parent;
+ }
+
+ g_assert_not_reached ();
+}
+
static ClutterEvent *
create_crossing_event (ClutterStage *stage,
ClutterInputDevice *device,
@@ -3489,7 +3507,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;
@@ -3515,6 +3533,9 @@ clutter_stage_update_device (ClutterStage *stage,
point.y,
_clutter_actor_get_debug_name (new_actor));
+ if (emit_crossing)
+ root = common_root_actor (stage, new_actor, old_actor);
+
if (old_actor && emit_crossing)
{
event = create_crossing_event (stage,
@@ -3522,7 +3543,9 @@ clutter_stage_update_device (ClutterStage *stage,
CLUTTER_LEAVE,
old_actor, new_actor,
point, time);
- _clutter_process_event (event);
+ _clutter_actor_handle_event (old_actor,
+ next_after_root (stage, root, old_actor),
+ event);
clutter_event_free (event);
}
@@ -3533,7 +3556,9 @@ clutter_stage_update_device (ClutterStage *stage,
CLUTTER_ENTER,
new_actor, old_actor,
point, time);
- _clutter_process_event (event);
+ _clutter_actor_handle_event (new_actor,
+ next_after_root (stage, root, new_actor),
+ event);
clutter_event_free (event);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]