1
0
Fork 0

clutter/pick-stack: Add an allocation check to calculate_clear_area ()

We might pick an actor that needs relayout. I've seen this happen inside
hiding / unmapping in particular. In this case, calculate_clear_area ()
will call clutter_actor_get_abs_allocation_vertices () which in turn
will force a relayout. However, this is not what we want, because:

1. We don't want to run layout during picking.
2. If the actor needs an allocation, then the pick stack could not have
   used an up-to-date allocation, because it is not computed. Therefore
   this clear area would use a potentially completely different
   allocation than the one stored in the pick stack.

Thankfully, clear area seems to be used as a cache/optimization, so
let's just avoid computing it if the actor is not allocated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3425>
This commit is contained in:
Ivan Molodetskikh 2023-11-28 08:35:50 +04:00 committed by Marge Bot
parent adc5489ba7
commit edbc9a2086

View file

@ -462,6 +462,13 @@ calculate_clear_area (ClutterPickStack *pick_stack,
MtkRectangle rect;
int i;
if (!clutter_actor_has_allocation (pick_rec->actor))
{
if (clear_area)
*clear_area = NULL;
return;
}
clutter_actor_get_abs_allocation_vertices (pick_rec->actor,
(graphene_point3d_t *) &verts);
if (!get_verts_rectangle (verts, &rect))