1
0
Fork 0

clutter: Trigger repick on animation-less transform changes

We have a mechanism to trigger repick after animations on
clutter_actor_set_final_state(), but this will not happen if
animations are disabled.

In this case, shell transitions and other typically animatable
changes on the transform of actors will not naturally trigger
a pointer repick when those get instantly changed to the final
state, possibly preserving the cached state and missing the
just popped in actor altogether.

Trigger an instant repick on animation-less transform changes,
so that these situations are also handled correctly, and the
pointer drops the cached state and is able to find the new
actor.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2918
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3168>
This commit is contained in:
Carlos Garnacho 2023-08-09 16:00:49 +02:00 committed by Marge Bot
parent d99407b2e8
commit 4d76a21029

View file

@ -1004,6 +1004,8 @@ static void push_in_paint_unmapped_branch (ClutterActor *self,
static void pop_in_paint_unmapped_branch (ClutterActor *self,
guint count);
static void clutter_actor_update_pointer (ClutterActor *self);
static GQuark quark_actor_layout_info = 0;
static GQuark quark_actor_transform_info = 0;
static GQuark quark_actor_animation_info = 0;
@ -2449,6 +2451,13 @@ transform_changed (ClutterActor *actor)
NULL);
}
static void
update_pointer_if_not_animated (ClutterActor *actor)
{
if (!clutter_actor_has_transitions (actor))
clutter_actor_update_pointer (actor);
}
/*< private >
* clutter_actor_set_allocation_internal:
* @self: a #ClutterActor
@ -4279,6 +4288,7 @@ clutter_actor_set_pivot_point_internal (ClutterActor *self,
info->pivot = *pivot;
transform_changed (self);
update_pointer_if_not_animated (self);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_PIVOT_POINT]);
@ -4295,6 +4305,7 @@ clutter_actor_set_pivot_point_z_internal (ClutterActor *self,
info->pivot_z = pivot_z;
transform_changed (self);
update_pointer_if_not_animated (self);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_PIVOT_POINT_Z]);
@ -4329,6 +4340,7 @@ clutter_actor_set_translation_internal (ClutterActor *self,
g_assert_not_reached ();
transform_changed (self);
update_pointer_if_not_animated (self);
clutter_actor_queue_redraw (self);
g_object_notify_by_pspec (obj, pspec);
@ -4458,6 +4470,7 @@ clutter_actor_set_rotation_angle_internal (ClutterActor *self,
g_assert_not_reached ();
transform_changed (self);
update_pointer_if_not_animated (self);
clutter_actor_queue_redraw (self);
@ -4579,6 +4592,7 @@ clutter_actor_set_scale_factor_internal (ClutterActor *self,
g_assert_not_reached ();
transform_changed (self);
update_pointer_if_not_animated (self);
clutter_actor_queue_redraw (self);
g_object_notify_by_pspec (obj, pspec);
@ -10361,6 +10375,7 @@ clutter_actor_set_z_position_internal (ClutterActor *self,
info->z_position = z_position;
transform_changed (self);
update_pointer_if_not_animated (self);
clutter_actor_queue_redraw (self);
@ -13798,6 +13813,7 @@ clutter_actor_set_transform_internal (ClutterActor *self,
info->transform_set = !graphene_matrix_is_identity (&info->transform);
transform_changed (self);
update_pointer_if_not_animated (self);
clutter_actor_queue_redraw (self);
@ -18942,6 +18958,7 @@ clutter_actor_invalidate_transform (ClutterActor *self)
g_return_if_fail (CLUTTER_IS_ACTOR (self));
transform_changed (self);
update_pointer_if_not_animated (self);
}
/**
@ -19069,8 +19086,12 @@ clutter_actor_notify_transform_invalid (ClutterActor *self)
transform_changed (self);
ensure_valid_actor_transform (self);
g_assert (priv->transform_valid);
if (!graphene_matrix_equal (&old_transform, &priv->transform))
clutter_actor_queue_redraw (self);
{
update_pointer_if_not_animated (self);
clutter_actor_queue_redraw (self);
}
}