forked from AuroraMiddleware/gtk
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:
parent
965b3af8a1
commit
2d4f3e1365
@ -118,8 +118,12 @@ static void gtk_socket_notify (GObject *object,
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_socket_realize (GtkWidget *widget);
|
static void gtk_socket_realize (GtkWidget *widget);
|
||||||
static void gtk_socket_unrealize (GtkWidget *widget);
|
static void gtk_socket_unrealize (GtkWidget *widget);
|
||||||
static void gtk_socket_size_request (GtkWidget *widget,
|
static void gtk_socket_get_preferred_width (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
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,
|
static void gtk_socket_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gtk_socket_hierarchy_changed (GtkWidget *widget,
|
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->realize = gtk_socket_realize;
|
||||||
widget_class->unrealize = gtk_socket_unrealize;
|
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->size_allocate = gtk_socket_size_allocate;
|
||||||
widget_class->hierarchy_changed = gtk_socket_hierarchy_changed;
|
widget_class->hierarchy_changed = gtk_socket_hierarchy_changed;
|
||||||
widget_class->grab_notify = gtk_socket_grab_notify;
|
widget_class->grab_notify = gtk_socket_grab_notify;
|
||||||
@ -452,14 +457,15 @@ gtk_socket_unrealize (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_socket_size_request (GtkWidget *widget,
|
gtk_socket_get_preferred_width (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
{
|
{
|
||||||
GtkSocket *socket = GTK_SOCKET (widget);
|
GtkSocket *socket = GTK_SOCKET (widget);
|
||||||
|
|
||||||
if (socket->plug_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
|
else
|
||||||
{
|
{
|
||||||
@ -467,15 +473,32 @@ gtk_socket_size_request (GtkWidget *widget,
|
|||||||
_gtk_socket_windowing_size_request (socket);
|
_gtk_socket_windowing_size_request (socket);
|
||||||
|
|
||||||
if (socket->is_mapped && socket->have_size)
|
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);
|
GtkSocket *socket = GTK_SOCKET (widget);
|
||||||
requisition->height = MAX (socket->request_height, 1);
|
|
||||||
|
if (socket->plug_widget)
|
||||||
|
{
|
||||||
|
gtk_widget_get_preferred_height (socket->plug_widget, minimum, natural);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requisition->width = 1;
|
if (socket->is_mapped && !socket->have_size && socket->plug_window)
|
||||||
requisition->height = 1;
|
_gtk_socket_windowing_size_request (socket);
|
||||||
}
|
|
||||||
|
if (socket->is_mapped && socket->have_size)
|
||||||
|
*minimum = *natural = MAX (socket->request_height, 1);
|
||||||
|
else
|
||||||
|
*minimum = *natural = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user