[mutter] clutter/actor: Always use allocation size for picking
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/actor: Always use allocation size for picking
- Date: Tue, 23 Mar 2021 18:04:29 +0000 (UTC)
commit 0e97c0550e8ea894046659a0e93333b86119553e
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sun Mar 14 13:35:56 2021 +0100
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>
clutter/clutter/clutter-actor.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 831402d55c..0a0884415d 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]