mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 13:22:15 +00:00
clutter/stage: Allow claiming sequence outside of event handling context
Another baby step just like the last commit: This commit takes care of the opposite case: An action handling a sequence event stops further emission of events to actors. Since sequences remain around for longer than the context of just a single event, it makes sense to provide a way to "claim" those sequences even when outside of event handling context, so introduce API for that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
This commit is contained in:
parent
6939bed55c
commit
b3de224406
@ -178,6 +178,10 @@ void clutter_stage_maybe_lost_implicit_grab (ClutterStage *self,
|
||||
void clutter_stage_implicit_grab_actor_unmapped (ClutterStage *self,
|
||||
ClutterActor *actor);
|
||||
|
||||
void clutter_stage_notify_action_implicit_grab (ClutterStage *self,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
||||
|
@ -4263,6 +4263,21 @@ free_event_receiver (EventReceiver *receiver)
|
||||
g_clear_object (&receiver->action);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_all_actors_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->actor)
|
||||
g_clear_object (&receiver->actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_all_actions_from_chain (PointerDeviceEntry *entry)
|
||||
{
|
||||
@ -4528,3 +4543,21 @@ clutter_stage_implicit_grab_actor_unmapped (ClutterStage *self,
|
||||
cancel_implicit_grab_on_actor (entry, actor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_notify_action_implicit_grab (ClutterStage *self,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence)
|
||||
{
|
||||
ClutterStagePrivate *priv = self->priv;
|
||||
PointerDeviceEntry *entry;
|
||||
|
||||
if (sequence != NULL)
|
||||
entry = g_hash_table_lookup (priv->touch_sequences, sequence);
|
||||
else
|
||||
entry = g_hash_table_lookup (priv->pointer_devices, device);
|
||||
|
||||
g_assert (entry->press_count > 0);
|
||||
|
||||
remove_all_actors_from_chain (entry);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user