From: Emmanuele Bassi Date: Fri, 9 Jul 2010 17:37:34 +0000 (+0100) Subject: text: Layouts for single-line-mode entries are boundless X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=903560c6c8c50c28959c2588d24d288bc2c4db26;p=profile%2Fivi%2Fclutter.git text: Layouts for single-line-mode entries are boundless A PangoLayout for an editable, single-line text entry is by definition without a given width, since the actor will be clipped when being drawn. --- diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 7ab0fa1..78a24fd 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1819,9 +1819,13 @@ clutter_text_paint (ClutterActor *self) } clutter_actor_get_allocation_box (self, &alloc); - layout = clutter_text_create_layout (text, - alloc.x2 - alloc.x1, - alloc.y2 - alloc.y1); + + if (priv->editable && priv->single_line_mode) + layout = clutter_text_create_layout (text, -1, -1); + else + layout = clutter_text_create_layout (text, + alloc.x2 - alloc.x1, + alloc.y2 - alloc.y1); if (priv->editable && priv->cursor_visible) clutter_text_ensure_cursor_position (text); @@ -2016,10 +2020,17 @@ clutter_text_allocate (ClutterActor *self, /* Ensure that there is a cached layout with the right width so * that we don't need to create the text during the paint run + * + * if the Text is editable and in single line mode we don't want + * to have any limit on the layout size, since the paint will clip + * it to the allocation of the actor */ - clutter_text_create_layout (text, - box->x2 - box->x1, - box->y2 - box->y1); + if (text->priv->editable && text->priv->single_line_mode) + clutter_text_create_layout (text, -1, -1); + else + clutter_text_create_layout (text, + box->x2 - box->x1, + box->y2 - box->y1); parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class); parent_class->allocate (self, box, flags); @@ -3953,6 +3964,9 @@ clutter_text_get_layout (ClutterText *self) g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL); + if (self->priv->editable && self->priv->single_line_mode) + return clutter_text_create_layout (self, -1, -1); + clutter_actor_get_size (CLUTTER_ACTOR (self), &width, &height); return clutter_text_create_layout (self, width, height);