clutter/stage: Add function to maybe invalidate pointers on an actor

The function that currently invalidates pointers over an specific actor
also asserts for the situations where this invalidation makes sense to
happen (i.e. the actor became unmapped, or non-reactive).

We want to have a function that is more forgiving, and that doesn't
enforce any guarantees about the pointer focus actually changing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2532>
This commit is contained in:
Carlos Garnacho 2022-07-26 13:53:21 +02:00 committed by Marge Bot
parent d985069542
commit 6dabdec10e
2 changed files with 17 additions and 4 deletions

View File

@ -159,6 +159,9 @@ void clutter_stage_unlink_grab (ClutterStage *self,
void clutter_stage_invalidate_focus (ClutterStage *self,
ClutterActor *actor);
void clutter_stage_maybe_invalidate_focus (ClutterStage *self,
ClutterActor *actor);
G_END_DECLS
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */

View File

@ -3175,8 +3175,8 @@ clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage)
}
void
clutter_stage_invalidate_focus (ClutterStage *self,
ClutterActor *actor)
clutter_stage_maybe_invalidate_focus (ClutterStage *self,
ClutterActor *actor)
{
ClutterStagePrivate *priv = self->priv;
GHashTableIter iter;
@ -3185,8 +3185,6 @@ clutter_stage_invalidate_focus (ClutterStage *self,
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return;
g_assert (!clutter_actor_is_mapped (actor) || !clutter_actor_get_reactive (actor));
g_hash_table_iter_init (&iter, priv->pointer_devices);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
@ -3220,6 +3218,18 @@ clutter_stage_invalidate_focus (ClutterStage *self,
entry->coords,
CLUTTER_CURRENT_TIME);
}
}
void
clutter_stage_invalidate_focus (ClutterStage *self,
ClutterActor *actor)
{
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return;
g_assert (!clutter_actor_is_mapped (actor) || !clutter_actor_get_reactive (actor));
clutter_stage_maybe_invalidate_focus (self, actor);
if (actor != CLUTTER_ACTOR (self))
g_assert (!clutter_actor_has_pointer (actor));