mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
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
f5207ab647
commit
e3bf39b2e6
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user