diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 423cb7fa..28cfb669 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -3600,9 +3600,9 @@ mg_topicbar_update_height (GtkWidget *topic) if (width <= 1 && parent) width = gtk_widget_get_allocated_width (parent); width -= margin_left + margin_right; - if (width < 1) - width = 1; - if (prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline) + /* Until we have a usable allocation, keep a single-line height. + * The size-allocate callback will measure the wrapped topic again. */ + if (width > 0 && prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline) { pango_layout_set_width (layout, width * PANGO_SCALE); pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR); @@ -3618,7 +3618,7 @@ mg_topicbar_update_height (GtkWidget *topic) if (line_height <= 0) line_height = 16; - line_count = prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline ? + line_count = width > 0 && prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline ? pango_layout_get_line_count (layout) : 1; if (line_count <= 0) line_count = 1;