From 45c040f5c4daf1f7cc83f40bb06d667db744c89b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 25 Jan 2008 21:41:50 +0000 Subject: [PATCH] 2008-01-25 Emmanuele Bassi * clutter/clutter-label.c (clutter_label_query_coords): Check if the layout logical rectangle size is bigger than the bounding box; this usually means that the bounding box changed in one point and the label private allocation needs to be updated. (#724) --- ChangeLog | 8 ++++++++ clutter/clutter-label.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2a01277f..1d6f5eac7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-01-25 Emmanuele Bassi + + * clutter/clutter-label.c (clutter_label_query_coords): Check + if the layout logical rectangle size is bigger than the bounding + box; this usually means that the bounding box changed in one + point and the label private allocation needs to be + updated. (#724) + 2008-01-25 Emmanuele Bassi * clutter/x11/Makefile.am: Add the generated clutter-x11 pkg-config diff --git a/clutter/clutter-label.c b/clutter/clutter-label.c index da4bb0fbc..a51afd25f 100644 --- a/clutter/clutter-label.c +++ b/clutter/clutter-label.c @@ -312,17 +312,12 @@ clutter_label_query_coords (ClutterActor *self, ClutterActorBox *box) { ClutterLabel *label = CLUTTER_LABEL(self); - ClutterLabelPrivate *priv; + ClutterLabelPrivate *priv; + ClutterActorBox layout_box = { 0, }; PangoRectangle logical_rect; priv = label->priv; - if ((priv->allocation.x2 - priv->allocation.x1) > 0) - { - *box = priv->allocation; - return; - } - if (priv->wrap) clutter_label_clear_layout (label); @@ -330,8 +325,28 @@ clutter_label_query_coords (ClutterActor *self, pango_layout_get_extents (priv->layout, NULL, &logical_rect); - box->x2 = box->x1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.width); - box->y2 = box->y1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.height); + layout_box.x1 = box->x1; + layout_box.x2 = box->x1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.width); + layout_box.y1 = box->y1; + layout_box.y2 = box->y1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.height); + + if ((priv->allocation.x2 - priv->allocation.x1) > 0) + { + ClutterUnit alloc_width, alloc_height; + + alloc_width = priv->allocation.x2 - priv->allocation.x1; + alloc_height = priv->allocation.y2 - priv->allocation.y1; + + if ((alloc_width >= (layout_box.x2 - layout_box.x1)) && + (alloc_height >= (layout_box.y2 - layout_box.y1))) + *box = priv->allocation; + else + *box = layout_box; + + return; + } + else + *box = layout_box; } static void