[gtk+/kill-size-request] Remove size_request from GtkSocket
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/kill-size-request] Remove size_request from GtkSocket
- Date: Wed, 27 Oct 2010 15:19:33 +0000 (UTC)
commit e3bf39b2e68e3f574b8bdfbbe82539c835aa94a8
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 27 11:17:40 2010 -0400
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.
gtk/gtksocket.c | 53 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 38 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index b78991d..b50d1c8 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]