[mutter/wip/carlosg/repick-on-reactive-42: 1/2] clutter/stage: Add function to maybe invalidate pointers on an actor




commit 787bd707ab96f3bab9a332bc28a78d9bee4f4d38
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 26 13:53:21 2022 +0200

    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.
    
    (cherry-picked from commit 6dabdec10ea4d5a256d90b48695adf0669883d51)
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2533>

 clutter/clutter/clutter-stage-private.h |  3 +++
 clutter/clutter/clutter-stage.c         | 18 ++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h
index b1a8105d22..72917853f3 100644
--- a/clutter/clutter/clutter-stage-private.h
+++ b/clutter/clutter/clutter-stage-private.h
@@ -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__ */
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index e97cd54a3f..17186c229d 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -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));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]