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

Use GTK3's method of setting GtkEntry min width.

The config box setup code wants a lot of very narrow edit boxes, so it
decreases their minimum width from the GTK default of 150 pixels. In
GTK 3, we have to do this using gtk_entry_set_width_chars() rather
than gtk_widget_set_size_request() as we were previously using, or it
won't work.

This change by itself seems to restore the GTK3 config box to a
sensible layout, in spite of the fact that my Columns layout class is
still doing all its size allocation the GTK2 way, with no attention
paid to the shiny new GTK3 height-for-width system.
This commit is contained in:
Simon Tatham 2015-08-22 10:37:48 +01:00
parent e460f30831
commit 5e738877be

View File

@ -2022,18 +2022,30 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
G_CALLBACK(editbox_lostfocus), dp); G_CALLBACK(editbox_lostfocus), dp);
g_signal_connect(G_OBJECT(signalobject), "focus_out_event", g_signal_connect(G_OBJECT(signalobject), "focus_out_event",
G_CALLBACK(editbox_lostfocus), dp); G_CALLBACK(editbox_lostfocus), dp);
/*
* Find out the edit box's height, which we'll need
* for vertical centring below (and, in GTK2, size
* tweaking as well).
*/
gtk_widget_size_request(w, &req);
#if !GTK_CHECK_VERSION(3,0,0)
/* /*
* Edit boxes, for some strange reason, have a minimum * Edit boxes, for some strange reason, have a minimum
* width of 150 in GTK 1.2. We don't want this - we'd * width of 150 in GTK 1.2. We don't want this - we'd
* rather the edit boxes acquired their natural width * rather the edit boxes acquired their natural width
* from the column layout of the rest of the box. * from the column layout of the rest of the box.
*
* Also, while we're here, we'll squirrel away the
* edit box height so we can use that to centre its
* label vertically beside it.
*/ */
gtk_widget_size_request(w, &req);
gtk_widget_set_size_request(w, 10, req.height); gtk_widget_set_size_request(w, 10, req.height);
#else
/*
* In GTK 3, this is still true, but there's a special
* method for GtkEntry in particular to fix it.
*/
if (GTK_IS_ENTRY(w))
gtk_entry_set_width_chars(GTK_ENTRY(w), 1);
#endif
if (ctrl->generic.label) { if (ctrl->generic.label) {
GtkWidget *label, *container; GtkWidget *label, *container;