2007-12-20 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-label.c:
	(clutter_label_query_coords): Return the bounding box set inside
	request_coords(), if any; otherwise, return the natural allocation
	of the label. (#678, reported by Gwenole Beauchesne)

	* tests/test-rotate.c: Align the label
This commit is contained in:
Emmanuele Bassi 2007-12-20 09:22:05 +00:00
parent 263d8ea5a0
commit ecded5cb7c
3 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2007-12-20 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-label.c:
(clutter_label_query_coords): Return the bounding box set inside
request_coords(), if any; otherwise, return the natural allocation
of the label. (#678, reported by Gwenole Beauchesne)
* tests/test-rotate.c: Align the label
2007-12-19 Tomas Frydrych <tf@openedhand.com> 2007-12-19 Tomas Frydrych <tf@openedhand.com>
* clutter/Makefile.am: * clutter/Makefile.am:

View File

@ -315,6 +315,12 @@ clutter_label_query_coords (ClutterActor *self,
priv = label->priv; priv = label->priv;
if ((priv->allocation.x2 - priv->allocation.x1) > 0)
{
*box = priv->allocation;
return;
}
if (priv->wrap) if (priv->wrap)
clutter_label_clear_layout (label); clutter_label_clear_layout (label);
@ -324,8 +330,6 @@ clutter_label_query_coords (ClutterActor *self,
box->x2 = box->x1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.width); box->x2 = box->x1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.width);
box->y2 = box->y1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.height); box->y2 = box->y1 + CLUTTER_UNITS_FROM_PANGO_UNIT (logical_rect.height);
return;
} }
static void static void

View File

@ -36,6 +36,7 @@ main (int argc, char *argv[])
clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand); clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand);
label = clutter_label_new_with_text ("Mono 16", "The Wonder of the Spinning Hand"); label = clutter_label_new_with_text ("Mono 16", "The Wonder of the Spinning Hand");
clutter_label_set_alignment (CLUTTER_LABEL (label), PANGO_ALIGN_CENTER);
clutter_actor_set_position (label, 150, 150); clutter_actor_set_position (label, 150, 150);
clutter_actor_show (label); clutter_actor_show (label);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label); clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);