clutter: Notify ClutterActions about sequences that were cancelled
We're almost there, everything is in place to notify ClutterActions about a sequence getting pulled away under its feet. The only thing that's missing is the actual notification to actions now, so let's do that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
This commit is contained in:
parent
b3de224406
commit
cf2d44d2c2
@ -39,6 +39,10 @@ void clutter_action_set_phase (ClutterAction *action,
|
|||||||
gboolean clutter_action_handle_event (ClutterAction *action,
|
gboolean clutter_action_handle_event (ClutterAction *action,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
|
||||||
|
void clutter_action_sequence_cancelled (ClutterAction *action,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* CLUTTER_ACTION_PRIVATE_H */
|
#endif /* CLUTTER_ACTION_PRIVATE_H */
|
||||||
|
@ -101,3 +101,14 @@ clutter_action_handle_event (ClutterAction *action,
|
|||||||
{
|
{
|
||||||
return CLUTTER_ACTION_GET_CLASS (action)->handle_event (action, event);
|
return CLUTTER_ACTION_GET_CLASS (action)->handle_event (action, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_action_sequence_cancelled (ClutterAction *action,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence)
|
||||||
|
{
|
||||||
|
ClutterActionClass *action_class = CLUTTER_ACTION_GET_CLASS (action);
|
||||||
|
|
||||||
|
if (action_class->sequence_cancelled)
|
||||||
|
action_class->sequence_cancelled (action, device, sequence);
|
||||||
|
}
|
||||||
|
@ -52,6 +52,10 @@ struct _ClutterActionClass
|
|||||||
gboolean (* handle_event) (ClutterAction *action,
|
gboolean (* handle_event) (ClutterAction *action,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
|
||||||
|
void (* sequence_cancelled) (ClutterAction *action,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence);
|
||||||
|
|
||||||
void (* _clutter_action1) (void);
|
void (* _clutter_action1) (void);
|
||||||
void (* _clutter_action2) (void);
|
void (* _clutter_action2) (void);
|
||||||
void (* _clutter_action3) (void);
|
void (* _clutter_action3) (void);
|
||||||
|
@ -4289,7 +4289,12 @@ remove_all_actions_from_chain (PointerDeviceEntry *entry)
|
|||||||
&g_array_index (entry->event_emission_chain, EventReceiver, i);
|
&g_array_index (entry->event_emission_chain, EventReceiver, i);
|
||||||
|
|
||||||
if (receiver->action)
|
if (receiver->action)
|
||||||
g_clear_object (&receiver->action);
|
{
|
||||||
|
clutter_action_sequence_cancelled (receiver->action,
|
||||||
|
entry->device,
|
||||||
|
entry->sequence);
|
||||||
|
g_clear_object (&receiver->action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4339,6 +4344,7 @@ clutter_stage_maybe_lost_implicit_grab (ClutterStage *self,
|
|||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = self->priv;
|
ClutterStagePrivate *priv = self->priv;
|
||||||
PointerDeviceEntry *entry = NULL;
|
PointerDeviceEntry *entry = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (sequence != NULL)
|
if (sequence != NULL)
|
||||||
entry = g_hash_table_lookup (priv->touch_sequences, sequence);
|
entry = g_hash_table_lookup (priv->touch_sequences, sequence);
|
||||||
@ -4350,6 +4356,15 @@ clutter_stage_maybe_lost_implicit_grab (ClutterStage *self,
|
|||||||
if (!entry->press_count)
|
if (!entry->press_count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < entry->event_emission_chain->len; i++)
|
||||||
|
{
|
||||||
|
EventReceiver *receiver =
|
||||||
|
&g_array_index (entry->event_emission_chain, EventReceiver, i);
|
||||||
|
|
||||||
|
if (receiver->action)
|
||||||
|
clutter_action_sequence_cancelled (receiver->action, device, sequence);
|
||||||
|
}
|
||||||
|
|
||||||
sync_crossings_on_implicit_grab_end (self, entry);
|
sync_crossings_on_implicit_grab_end (self, entry);
|
||||||
|
|
||||||
clutter_actor_set_implicitly_grabbed (entry->implicit_grab_actor, FALSE);
|
clutter_actor_set_implicitly_grabbed (entry->implicit_grab_actor, FALSE);
|
||||||
@ -4505,7 +4520,12 @@ cancel_implicit_grab_on_actor (PointerDeviceEntry *entry,
|
|||||||
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (receiver->action));
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (receiver->action));
|
||||||
|
|
||||||
if (!action_actor || action_actor == actor)
|
if (!action_actor || action_actor == actor)
|
||||||
g_clear_object (&receiver->action);
|
{
|
||||||
|
clutter_action_sequence_cancelled (receiver->action,
|
||||||
|
entry->device,
|
||||||
|
entry->sequence);
|
||||||
|
g_clear_object (&receiver->action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user