2008-07-02 Emmanuele Bassi <ebassi@openedhand.com>
authorEmmanuele Bassi <ebassi@openedhand.com>
Wed, 2 Jul 2008 09:24:25 +0000 (09:24 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Wed, 2 Jul 2008 09:24:25 +0000 (09:24 +0000)
Bug 1010 - ClutterLabel does not update the layout (Lee Jusung)

* clutter/clutter-actor.c:
(clutter_actor_queue_relayout): Remove some pointer dereferencing.

* clutter/clutter-label.c:
(clutter_label_allocate): Revert the change of r2883 and remove the
layout width cache and force a recreation of the layout every time
we receive an allocation.

ChangeLog
clutter/clutter-actor.c
clutter/clutter-label.c

index faf6288..4cedfb3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-07-02  Emmanuele Bassi  <ebassi@openedhand.com>
+
+       Bug 1010 - ClutterLabel does not update the layout (Lee Jusung)
+
+       * clutter/clutter-actor.c:
+       (clutter_actor_queue_relayout): Remove some pointer dereferencing.
+       
+       * clutter/clutter-label.c:
+       (clutter_label_allocate): Revert the change of r2883 and remove the
+       layout width cache and force a recreation of the layout every time
+       we receive an allocation.
+
 2008-07-01  Neil Roberts  <neil@o-hand.com>
 
        * clutter/clutter-actor.c (clutter_actor_get_transformed_sizeu):
index fc0bc73..ad10256 100644 (file)
@@ -3042,17 +3042,17 @@ clutter_actor_queue_relayout (ClutterActor *self)
       priv->needs_allocation)
     return; /* save some cpu cycles */
 
-  self->priv->needs_width_request  = TRUE;
-  self->priv->needs_height_request = TRUE;
-  self->priv->needs_allocation     = TRUE;
+  priv->needs_width_request  = TRUE;
+  priv->needs_height_request = TRUE;
+  priv->needs_allocation     = TRUE;
 
   /* always repaint also */
   if (CLUTTER_ACTOR_IS_VISIBLE (self))
     clutter_actor_queue_redraw (self);
 
   /* We need to go all the way up the hierarchy */
-  if (self->priv->parent_actor)
-    clutter_actor_queue_relayout (self->priv->parent_actor);
+  if (priv->parent_actor)
+    clutter_actor_queue_relayout (priv->parent_actor);
 }
 
 /**
index 26f7410..77de374 100644 (file)
@@ -93,8 +93,6 @@ struct _ClutterLabelPrivate
   PangoAttrList        *attrs;
   PangoAttrList        *effective_attrs;
   PangoLayout          *layout;
-
-  ClutterUnit           layout_width;
 };
 
 /*
@@ -289,19 +287,15 @@ clutter_label_allocate (ClutterActor          *self,
   ClutterLabelPrivate *priv = label->priv;
   ClutterActorClass *parent_class;
 
-  if (priv->layout_width != (box->x2 - box->x1))
+  /* the allocation was changed, so we must recreate the layout */
+  if (priv->layout)
     {
-      /* the allocation was changed, so we must recreate the layout */
-      if (priv->layout)
-        {
-          g_object_unref (priv->layout);
-          priv->layout = NULL;
-        }
-
-      priv->layout = clutter_label_create_layout (label, box->x2 - box->x1);
-      priv->layout_width = box->x2 - box->x1;
+      g_object_unref (priv->layout);
+      priv->layout = NULL;
     }
 
+  priv->layout = clutter_label_create_layout (label, box->x2 - box->x1);
+
   parent_class = CLUTTER_ACTOR_CLASS (clutter_label_parent_class);
   parent_class->allocate (self, box, origin_changed);
 }