clutter/main: Change picked actor before emitting crossing events

Updating the state before emitting the CLUTTER_LEAVE event allows its
handlers to query the pointer actor, and avoid getting the same actor
again. Conceptually, this makes picking more "atomic", and the events a
notification of the change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1654>
This commit is contained in:
Carlos Garnacho 2020-12-22 17:25:48 +01:00
parent 3d82da23ec
commit 794962327e

View File

@ -1608,6 +1608,11 @@ clutter_stage_update_device (ClutterStage *stage,
old_actor = clutter_stage_get_device_actor (stage, device, sequence); old_actor = clutter_stage_get_device_actor (stage, device, sequence);
device_actor_changed = new_actor != old_actor; device_actor_changed = new_actor != old_actor;
clutter_stage_update_device_entry (stage,
device, sequence,
point,
new_actor);
if (device_actor_changed) if (device_actor_changed)
{ {
CLUTTER_NOTE (EVENT, CLUTTER_NOTE (EVENT,
@ -1625,15 +1630,7 @@ clutter_stage_update_device (ClutterStage *stage,
old_actor, new_actor, old_actor, new_actor,
point, time); point, time);
} }
}
clutter_stage_update_device_entry (stage,
device, sequence,
point,
new_actor);
if (device_actor_changed)
{
if (new_actor && emit_crossing) if (new_actor && emit_crossing)
{ {
create_crossing_event (stage, create_crossing_event (stage,