[clutter/wip/apocalypses/apocalypse-1: 42/44] actor: Tweak the underallocation warning



commit 30c9f710adde34afd2635f630b8c569d7bd969d2
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Dec 8 10:01:53 2011 +0000

    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.

 clutter/clutter-actor.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 9c1e0f1..9f9c3cc 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -1262,7 +1262,7 @@ clutter_actor_real_show (ClutterActor *self)
       /* we queue a relayout unless the actor is inside a
        * container that explicitly told us not to
        */
-      if (priv->parent_actor &&
+      if (priv->parent_actor != NULL &&
           (!(priv->parent_actor->flags & CLUTTER_ACTOR_NO_LAYOUT)))
         {
           /* 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
        * container that explicitly told us not to
        */
-      if (priv->parent_actor &&
+      if (priv->parent_actor != NULL &&
           (!(priv->parent_actor->flags & CLUTTER_ACTOR_NO_LAYOUT)))
         clutter_actor_queue_relayout (priv->parent_actor);
     }
@@ -6963,14 +6963,22 @@ clutter_actor_adjust_allocation (ClutterActor    *self,
     {
       ClutterActor *parent = clutter_actor_get_parent (self);
 
-      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,
-                 parent != NULL ? _clutter_actor_get_debug_name (parent)
-                                : "top-level",
-                 min_width, min_height);
+      /* the only actors that are allowed to be underallocated are the Stage,
+       * as it doesn't have an implicit size, and Actors that specifically
+       * told us that they want to opt-out from layout control mechanisms
+       * through the NO_LAYOUT escape hatch.
+       */
+      if (parent != NULL &&
+          !(self->flags & CLUTTER_ACTOR_NO_LAYOUT) != 0)
+        {
+          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
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]