clutter/stage: Make sequences exclusive to actors vs actions

As soon as any event of a sequence is handles/stopped during emission,
all actors and actions that would have gotten to see it afterwards have
a big problem: If that event was a TOUCH_END event, the actor/action is
forever going to think that this touch is still active.

For ClutterActions, we're going to handle this by introducing a way to
send them a notification when stuff like this happens.

As a baby step towards all that, make event emission exclusive to actors
as soon as any actor stopped an event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
This commit is contained in:
Jonas Dreßler 2022-11-19 17:15:20 +01:00 committed by Marge Bot
parent bac66fcbc4
commit 6939bed55c

View File

@ -4263,6 +4263,21 @@ free_event_receiver (EventReceiver *receiver)
g_clear_object (&receiver->action);
}
static void
remove_all_actions_from_chain (PointerDeviceEntry *entry)
{
unsigned int i;
for (i = 0; i < entry->event_emission_chain->len; i++)
{
EventReceiver *receiver =
&g_array_index (entry->event_emission_chain, EventReceiver, i);
if (receiver->action)
g_clear_object (&receiver->action);
}
}
static gboolean
setup_implicit_grab (PointerDeviceEntry *entry)
{
@ -4424,7 +4439,12 @@ clutter_stage_emit_event (ClutterStage *self,
if (entry && entry->press_count)
{
emit_event (event, entry->event_emission_chain);
EventHandledState state;
state = emit_event (event, entry->event_emission_chain);
if (state == EVENT_HANDLED_BY_ACTOR)
remove_all_actions_from_chain (entry);
}
else
{