1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-21 21:15:03 -05:00

In GTK3, omit our GTK 1/2 workaround for wrapping labels.

Now we're properly implementing the GTK3 height-for-width layout
model, this bodge is no longer necessary.
This commit is contained in:
Simon Tatham 2015-08-23 15:01:07 +01:00
parent e076959f6c
commit 80259e85c2

View File

@ -1851,6 +1851,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
} }
} }
#if !GTK_CHECK_VERSION(3,0,0)
static void label_sizealloc(GtkWidget *widget, GtkAllocation *alloc, static void label_sizealloc(GtkWidget *widget, GtkAllocation *alloc,
gpointer data) gpointer data)
{ {
@ -1861,6 +1862,7 @@ static void label_sizealloc(GtkWidget *widget, GtkAllocation *alloc,
gtk_label_set_text(GTK_LABEL(uc->text), uc->ctrl->generic.label); gtk_label_set_text(GTK_LABEL(uc->text), uc->ctrl->generic.label);
g_signal_handler_disconnect(G_OBJECT(uc->text), uc->textsig); g_signal_handler_disconnect(G_OBJECT(uc->text), uc->textsig);
} }
#endif
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* This function does the main layout work: it reads a controlset, * This function does the main layout work: it reads a controlset,
@ -2436,6 +2438,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
GtkRequisition req; GtkRequisition req;
label = gtk_label_new(ctrl->generic.label); label = gtk_label_new(ctrl->generic.label);
gtk_label_set_width_chars(GTK_LABEL(label), 3);
shortcut_add(scs, label, ctrl->listbox.shortcut, shortcut_add(scs, label, ctrl->listbox.shortcut,
SHORTCUT_FOCUS, w); SHORTCUT_FOCUS, w);
@ -2467,8 +2470,9 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
break; break;
case CTRL_TEXT: case CTRL_TEXT:
#if !GTK_CHECK_VERSION(3,0,0)
/* /*
* Wrapping text widgets don't sit well with the GTK * Wrapping text widgets don't sit well with the GTK2
* layout model, in which widgets state a minimum size * layout model, in which widgets state a minimum size
* and the whole window then adjusts to the smallest * and the whole window then adjusts to the smallest
* size it can sensibly take given its contents. A * size it can sensibly take given its contents. A
@ -2493,11 +2497,20 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
* than one line). * than one line).
*/ */
uc->text = w = gtk_label_new("X"); uc->text = w = gtk_label_new("X");
gtk_misc_set_alignment(GTK_MISC(w), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
uc->textsig = uc->textsig =
g_signal_connect(G_OBJECT(w), "size-allocate", g_signal_connect(G_OBJECT(w), "size-allocate",
G_CALLBACK(label_sizealloc), dp); G_CALLBACK(label_sizealloc), dp);
#else
/*
* In GTK3, this is all fixed, because the main aim of the
* new 'height-for-width' geometry management is to make
* wrapping labels behave sensibly. So now we can just do
* the obvious thing.
*/
uc->text = w = gtk_label_new(uc->ctrl->generic.label);
#endif
gtk_misc_set_alignment(GTK_MISC(w), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
break; break;
} }