Remove size_request from GtkSocket

This is only preliminary, GtkSocket can do minimal/natural width
properly, there's code for that in the extended-layout branch.
This commit is contained in:
Matthias Clasen 2010-10-27 11:17:40 -04:00 committed by Tristan Van Berkom
parent 965b3af8a1
commit 2d4f3e1365

View File

@ -118,8 +118,12 @@ static void gtk_socket_notify (GObject *object,
GParamSpec *pspec);
static void gtk_socket_realize (GtkWidget *widget);
static void gtk_socket_unrealize (GtkWidget *widget);
static void gtk_socket_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_socket_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_socket_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_socket_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_socket_hierarchy_changed (GtkWidget *widget,
@ -197,7 +201,8 @@ gtk_socket_class_init (GtkSocketClass *class)
widget_class->realize = gtk_socket_realize;
widget_class->unrealize = gtk_socket_unrealize;
widget_class->size_request = gtk_socket_size_request;
widget_class->get_preferred_width = gtk_socket_get_preferred_width;
widget_class->get_preferred_height = gtk_socket_get_preferred_height;
widget_class->size_allocate = gtk_socket_size_allocate;
widget_class->hierarchy_changed = gtk_socket_hierarchy_changed;
widget_class->grab_notify = gtk_socket_grab_notify;
@ -452,14 +457,15 @@ gtk_socket_unrealize (GtkWidget *widget)
}
static void
gtk_socket_size_request (GtkWidget *widget,
GtkRequisition *requisition)
gtk_socket_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkSocket *socket = GTK_SOCKET (widget);
if (socket->plug_widget)
{
gtk_widget_get_preferred_size (socket->plug_widget, requisition, NULL);
gtk_widget_get_preferred_width (socket->plug_widget, minimum, natural);
}
else
{
@ -467,15 +473,32 @@ gtk_socket_size_request (GtkWidget *widget,
_gtk_socket_windowing_size_request (socket);
if (socket->is_mapped && socket->have_size)
*minimum = *natural = MAX (socket->request_width, 1);
else
*minimum = *natural = 1;
}
}
static void
gtk_socket_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
requisition->width = MAX (socket->request_width, 1);
requisition->height = MAX (socket->request_height, 1);
GtkSocket *socket = GTK_SOCKET (widget);
if (socket->plug_widget)
{
gtk_widget_get_preferred_height (socket->plug_widget, minimum, natural);
}
else
{
requisition->width = 1;
requisition->height = 1;
}
if (socket->is_mapped && !socket->have_size && socket->plug_window)
_gtk_socket_windowing_size_request (socket);
if (socket->is_mapped && socket->have_size)
*minimum = *natural = MAX (socket->request_height, 1);
else
*minimum = *natural = 1;
}
}