Commit 2d4f3e13 authored by Matthias Clasen's avatar Matthias Clasen Committed by Tristan Van Berkom

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.
parent 965b3af8
......@@ -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,30 +457,48 @@ 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
{
if (socket->is_mapped && !socket->have_size && socket->plug_window)
_gtk_socket_windowing_size_request (socket);
_gtk_socket_windowing_size_request (socket);
if (socket->is_mapped && socket->have_size)
{
requisition->width = MAX (socket->request_width, 1);
requisition->height = MAX (socket->request_height, 1);
}
*minimum = *natural = MAX (socket->request_width, 1);
else
{
requisition->width = 1;
requisition->height = 1;
}
*minimum = *natural = 1;
}
}
static void
gtk_socket_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkSocket *socket = GTK_SOCKET (widget);
if (socket->plug_widget)
{
gtk_widget_get_preferred_height (socket->plug_widget, minimum, natural);
}
else
{
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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment