Skip to content

clutter/actor: Don't compute resource scale during mapping an actor

There are a few reasons why it's a bad idea to ensure a valid resource scale while mapping an actor:

  • The actor does not have a valid allocation yet, which means the scale might be wrong and computing it will be inefficient (we need to go up the actor hierarchy until we find an actor with a valid allocation)

  • Implementations which query the resource scale using clutter_actor_get_resource_scale() will also trigger a calculation, so this is only really needed to notify the resource-scale property (which, again, might be done using a wrong value). Also we notify that property before painting, too, and there it makes much more sense since the allocation and transformation are guaranteed to be correct.

  • The reason this exists nonetheless is probably because it papers over a gnome-shell bug by calculating the transformation matrices: The apply_transform() implementation of ClutterClone calls clutter_actor_get_allocation_box(), which will trigger a stage relayout to ensure a valid allocation. That allocates the ControlsManager of the overview while mapping it, which the workspaces view currently depends on to work, see gnome-shell!1119 (merged).

The behaviour of triggering an immediate stage relayout when ClutterClones are involved is also the root cause of gnome-shell#1065 (closed): When looking at the backtraces there, all the allocation cycles leading to the error are happening during mapping the actor. For the fix of ClutterClones, making them avoid that relayout, see !1181 (merged).

So simply stop computing the resource-scale while mapping actors because it's superfluous. This should also reduce the number of resource-scale calculations significantly.

Depends on gnome-shell!1119 (merged)

Edited by Jonas Dreßler

Merge request reports