clutter/actor: Always use allocation size for picking
The usage of clutter_actor_get_preferred_width/height() for building the pick box can trigger Clutters size negotiation machinery in case the allocation of the actor is invalidated, with commit 82f3bdd1 we worked around that by excluding actors with invalidated allocations from picking. There's no need to do that though, when picking we always want to operate on the last known allocation of the actor, since that is what's actually painted on the screen. So instead of not picking at all when an actors allocation is invalidated, just use the size of the last allocation. We still have to factor in one extra case, that's when an actor hasn't gotten any allocation yet: In that case we want to exclude the actor from picking since the actor is not on the screen yet. This fixes a regression introduced by the commit mentioned above where picking wouldn't work on windows that have just been resized. https://gitlab.gnome.org/GNOME/mutter/-/issues/1674 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1784>
This commit is contained in:
parent
4bee25d8e6
commit
0e97c0550e
1 changed files with 5 additions and 3 deletions
|
@ -2225,13 +2225,15 @@ static void
|
|||
clutter_actor_real_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
|
||||
if (clutter_actor_should_pick (self, pick_context))
|
||||
{
|
||||
ClutterActorBox box = {
|
||||
.x1 = 0,
|
||||
.y1 = 0,
|
||||
.x2 = clutter_actor_get_width (self),
|
||||
.y2 = clutter_actor_get_height (self),
|
||||
.x2 = priv->allocation.x2 - priv->allocation.x1,
|
||||
.y2 = priv->allocation.y2 - priv->allocation.y1,
|
||||
};
|
||||
|
||||
clutter_actor_pick_box (self, pick_context, &box);
|
||||
|
@ -2275,7 +2277,7 @@ clutter_actor_should_pick (ClutterActor *self,
|
|||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (self) &&
|
||||
clutter_actor_has_allocation (self) &&
|
||||
clutter_actor_box_is_initialized (&self->priv->allocation) &&
|
||||
(clutter_pick_context_get_mode (pick_context) == CLUTTER_PICK_ALL ||
|
||||
CLUTTER_ACTOR_IS_REACTIVE (self)))
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue