1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Make Columns disregard the preferred width of GtkEntry.

On OS X GTK, it requests a preferred width that's way too large. I
think that's because that's based on its max_width_chars rather than
its width_chars (and I only set the latter). But I don't want to
actually reduce its max_width_chars, in case (either now or in a
future version) that causes it to actually refuse to take up all the
space it's allocated.
This commit is contained in:
Simon Tatham 2015-08-27 18:59:24 +01:00
parent b8dd15b8ff
commit 9edf7910fc

View File

@ -980,14 +980,19 @@ static gint columns_gtk3_get_nat_width(ColumnsChild *child)
{ {
gint ret; gint ret;
if (GTK_IS_LABEL(child->widget) && if ((GTK_IS_LABEL(child->widget) &&
gtk_label_get_line_wrap(GTK_LABEL(child->widget))) { gtk_label_get_line_wrap(GTK_LABEL(child->widget))) ||
GTK_IS_ENTRY(child->widget)) {
/* /*
* We treat wrapping GtkLabels as a special case in this * We treat wrapping GtkLabels as a special case in this
* layout class, because the whole point of those is that I * layout class, because the whole point of those is that I
* _don't_ want them to take up extra horizontal space for * _don't_ want them to take up extra horizontal space for
* long text, but instead to wrap it to whatever size is used * long text, but instead to wrap it to whatever size is used
* by the rest of the layout. * by the rest of the layout.
*
* GtkEntry gets similar treatment, because in OS X GTK I've
* found that it requests a natural width regardless of the
* output of gtk_entry_set_width_chars.
*/ */
gtk_widget_get_preferred_width(child->widget, &ret, NULL); gtk_widget_get_preferred_width(child->widget, &ret, NULL);
} else { } else {