From 487749c25b35096dfcb1817f2e667714440d8045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 12 Oct 2012 22:37:18 +0200 Subject: [PATCH] st-entry: Force a relayout if necessary ClutterText will only queue a relayout after font changes if it has any contents other than the empty string. As a result, its height request may change after the first character has been entered. To avoid this visual glitch, force a relayout on actual font changes. https://bugzilla.gnome.org/show_bug.cgi?id=685534 --- src/st/st-entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/st/st-entry.c b/src/st/st-entry.c index c6b8701f8..ad9b3a84f 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -242,7 +242,7 @@ st_entry_style_changed (StWidget *self) StThemeNode *theme_node; ClutterColor color; const PangoFontDescription *font; - gchar *font_string; + gchar *font_string, *font_name; gdouble size; theme_node = st_widget_get_theme_node (self); @@ -264,8 +264,12 @@ st_entry_style_changed (StWidget *self) font = st_theme_node_get_font (theme_node); font_string = pango_font_description_to_string (font); + font_name = g_strdup (clutter_text_get_font_name (CLUTTER_TEXT (priv->entry))); clutter_text_set_font_name (CLUTTER_TEXT (priv->entry), font_string); + if (strcmp (clutter_text_get_font_name (CLUTTER_TEXT (priv->entry)), font_name) != 0) + clutter_actor_queue_relayout (priv->entry); g_free (font_string); + g_free (font_name); ST_WIDGET_CLASS (st_entry_parent_class)->style_changed (self); }