actor: Tweak the underallocation warning

There are only two kinds of actors that allow underallocations,
according to the API contract:

  • ClutterStage, as it is a viewport and it doesn't have an implicit
    minimum size;

  • Actors using the CLUTTER_ACTOR_NO_LAYOUT escape hatch, which allows
    them to bail out from our layout management policies.

The warning about underallocations should take these two exceptions
under consideration.
This commit is contained in:
Emmanuele Bassi 2011-12-08 10:01:53 +00:00 committed by Emmanuele Bassi
parent 6d268fe5ca
commit 376bf4a990

View File

@ -1262,7 +1262,7 @@ clutter_actor_real_show (ClutterActor *self)
/* we queue a relayout unless the actor is inside a /* we queue a relayout unless the actor is inside a
* container that explicitly told us not to * container that explicitly told us not to
*/ */
if (priv->parent_actor && if (priv->parent_actor != NULL &&
(!(priv->parent_actor->flags & CLUTTER_ACTOR_NO_LAYOUT))) (!(priv->parent_actor->flags & CLUTTER_ACTOR_NO_LAYOUT)))
{ {
/* While an actor is hidden the parent may not have /* While an actor is hidden the parent may not have
@ -1384,7 +1384,7 @@ clutter_actor_real_hide (ClutterActor *self)
/* we queue a relayout unless the actor is inside a /* we queue a relayout unless the actor is inside a
* container that explicitly told us not to * container that explicitly told us not to
*/ */
if (priv->parent_actor && if (priv->parent_actor != NULL &&
(!(priv->parent_actor->flags & CLUTTER_ACTOR_NO_LAYOUT))) (!(priv->parent_actor->flags & CLUTTER_ACTOR_NO_LAYOUT)))
clutter_actor_queue_relayout (priv->parent_actor); clutter_actor_queue_relayout (priv->parent_actor);
} }
@ -6999,14 +6999,22 @@ clutter_actor_adjust_allocation (ClutterActor *self,
{ {
ClutterActor *parent = clutter_actor_get_parent (self); ClutterActor *parent = clutter_actor_get_parent (self);
g_warning (G_STRLOC ": The actor '%s' is getting an allocation " /* the only actors that are allowed to be underallocated are the Stage,
"of %.2f x %.2f from its parent actor '%s', but its " * as it doesn't have an implicit size, and Actors that specifically
"requested minimum size is of %.2f x %.2f", * told us that they want to opt-out from layout control mechanisms
_clutter_actor_get_debug_name (self), * through the NO_LAYOUT escape hatch.
alloc_width, alloc_height, */
parent != NULL ? _clutter_actor_get_debug_name (parent) if (parent != NULL &&
: "top-level", !(self->flags & CLUTTER_ACTOR_NO_LAYOUT) != 0)
min_width, min_height); {
g_warning (G_STRLOC ": The actor '%s' is getting an allocation "
"of %.2f x %.2f from its parent actor '%s', but its "
"requested minimum size is of %.2f x %.2f",
_clutter_actor_get_debug_name (self),
alloc_width, alloc_height,
_clutter_actor_get_debug_name (parent),
min_width, min_height);
}
} }
#endif #endif