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.
This commit is contained in:
parent
1635a2db12
commit
903560c6c8
@ -1819,6 +1819,10 @@ clutter_text_paint (ClutterActor *self)
|
||||
}
|
||||
|
||||
clutter_actor_get_allocation_box (self, &alloc);
|
||||
|
||||
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);
|
||||
@ -2016,7 +2020,14 @@ 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
|
||||
*/
|
||||
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);
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user