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

GTK3 port: replace size_request in the Columns layout class.

It's been replaced by a new pair of methods get_preferred_width and
get_preferred_height. For the moment, I've followed the porting
guide's suggestion of keeping the old size_request function as an
underlying implementation and having each of those methods just return
one of its outputs. The results are ugly, but it'll compile and run,
which is a start.
This commit is contained in:
Simon Tatham 2015-08-16 14:16:08 +01:00
parent 59a232c161
commit aac9d5fcf7

View File

@ -22,6 +22,12 @@ static void columns_forall(GtkContainer *container, gboolean include_internals,
static gint columns_focus(GtkContainer *container, GtkDirectionType dir);
#endif
static GType columns_child_type(GtkContainer *container);
#if GTK_CHECK_VERSION(3,0,0)
static void columns_get_preferred_width(GtkWidget *widget,
gint *min, gint *nat);
static void columns_get_preferred_height(GtkWidget *widget,
gint *min, gint *nat);
#endif
static void columns_size_request(GtkWidget *widget, GtkRequisition *req);
static void columns_size_allocate(GtkWidget *widget, GtkAllocation *alloc);
@ -104,7 +110,12 @@ static void columns_class_init(ColumnsClass *klass)
widget_class->draw = columns_draw;
widget_class->expose_event = columns_expose;
#endif
#if GTK_CHECK_VERSION(3,0,0)
widget_class->get_preferred_width = columns_get_preferred_width;
widget_class->get_preferred_height = columns_get_preferred_height;
#else
widget_class->size_request = columns_size_request;
#endif
widget_class->size_allocate = columns_size_allocate;
container_class->add = columns_base_add;
@ -642,6 +653,24 @@ static void columns_size_request(GtkWidget *widget, GtkRequisition *req)
g_free(colypos);
}
#if GTK_CHECK_VERSION(3,0,0)
static void columns_get_preferred_width(GtkWidget *widget,
gint *min, gint *nat)
{
GtkRequisition req;
columns_size_request(widget, &req);
*min = *nat = req.width;
}
static void columns_get_preferred_height(GtkWidget *widget,
gint *min, gint *nat)
{
GtkRequisition req;
columns_size_request(widget, &req);
*min = *nat = req.height;
}
#endif
static void columns_size_allocate(GtkWidget *widget, GtkAllocation *alloc)
{
Columns *cols;