mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 21:34:09 +00:00
[ClutterText] Fix actors with a width but no wrapping and the wrap modes
Setting the wrap mode on the PangoLayout seems to have disappeared during the text-actor-layout-height branch merge so this brings it back. The test for this in test-text-cache no longer needs to be disabled. We also shouldn't set the width on the layout if there is no wrapping or ellipsizing because otherwise it implicitly enables wrapping. This only matters if the actor gets allocated smaller than its natural size.
This commit is contained in:
parent
27bea43a4d
commit
9fdc9ca583
@ -284,6 +284,7 @@ clutter_text_create_layout_no_cache (ClutterText *text,
|
||||
pango_layout_set_alignment (layout, priv->alignment);
|
||||
pango_layout_set_single_paragraph_mode (layout, priv->single_line_mode);
|
||||
pango_layout_set_justify (layout, priv->justify);
|
||||
pango_layout_set_wrap (layout, priv->wrap_mode);
|
||||
|
||||
/* Cases, assuming ellipsize != NONE on actor:
|
||||
*
|
||||
@ -309,11 +310,14 @@ clutter_text_create_layout_no_cache (ClutterText *text,
|
||||
}
|
||||
}
|
||||
|
||||
/* we do not limit the layout width on editable, single-line
|
||||
* text actors, since those can scroll the layout
|
||||
/* We do not limit the layout width on editable, single-line text
|
||||
* actors, since those can scroll the layout. For non-editable
|
||||
* actors we only want to set the width if wrapping or ellipsizing
|
||||
* is enabled.
|
||||
*/
|
||||
if (allocation_width > 0 &&
|
||||
!(priv->editable && priv->single_line_mode))
|
||||
(priv->editable ? !priv->single_line_mode
|
||||
: (priv->ellipsize != PANGO_ELLIPSIZE_NONE || priv->wrap)))
|
||||
{
|
||||
gint width;
|
||||
|
||||
|
@ -202,7 +202,6 @@ do_tests (CallbackData *data)
|
||||
pango_layout_set_wrap (data->test_layout, PANGO_WRAP_WORD);
|
||||
g_assert (check_result (data, "Enable line wrap", TRUE) == FALSE);
|
||||
|
||||
#if 0
|
||||
/* TEST 11: change wrap mode
|
||||
* FIXME - broken
|
||||
*/
|
||||
@ -210,7 +209,6 @@ do_tests (CallbackData *data)
|
||||
PANGO_WRAP_CHAR);
|
||||
pango_layout_set_wrap (data->test_layout, PANGO_WRAP_CHAR);
|
||||
g_assert (check_result (data, "Change wrap mode", TRUE) == FALSE);
|
||||
#endif
|
||||
|
||||
/* TEST 12: enable justify */
|
||||
clutter_text_set_justify (CLUTTER_TEXT (data->label), TRUE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user