Skip to content

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

Layout during picking is slow and isn't really supposed to happen. With this MR, I haven't yet seen any other places that call layout during picking.

I'm not familiar with the picking code, but as far as I understood, clear area is some sort of cache / performance optimization, so it's ok to just not set it in this case. From 19cdba8a:

This safe area is the region (in stage coordinates) where the pointer is ensured to stay within the current actor. This is not used yet, but will be used for optimizations in pointer picking.

So, this is the commit message I wrote:

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.

cc @verdre @carlosg

Closes #3084 (closed)

Merge request reports