Compare commits

...

2 Commits

Author SHA1 Message Date
Matthias Clasen
d305148912 tooltip: Prevent too-wide tooltip windows
Set the label to expand, so it actually fills
the width that we allocated for it, instead
of shrinking back to the minimum width for
its height.

Fixes: #5521
2023-01-28 10:33:40 -05:00
Matthias Clasen
4b6a9d2fb5 tooltip: Don't play games with max-width-chars
Setting max-width-chars to the number of characters
in the string works ok only as long as the average
char width we get from Pango matches reality. Sadly
that seems not always the case, and this code was
causing short Chinese tooltips to always be broken
into two lines.

Fixes: #4470
2023-01-28 10:33:40 -05:00
2 changed files with 2 additions and 5 deletions

View File

@@ -413,11 +413,7 @@ update_label_width (GtkLabel *label)
}
else
{
int len;
len = g_utf8_strlen (text, -1);
gtk_label_set_max_width_chars (label, MIN (len, 50));
gtk_label_set_max_width_chars (label, 50);
gtk_label_set_wrap (label, TRUE);
}
}

View File

@@ -13,6 +13,7 @@
</child>
<child>
<object class="GtkLabel" id="label">
<property name="hexpand">1</property>
<property name="wrap">1</property>
</object>
</child>