diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-02-10 02:35:09 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-02-10 02:35:09 +0000 |
commit | d1bda8d56232ff0431796add4029e129f877fd6a (patch) | |
tree | 63c722c3ed4b8a886242bc78ae78dae1811c6b3a /gtk/gtkwidget.c | |
parent | 84d9f5f9a13d52cd91bffc6230445d1e0ac73431 (diff) | |
download | gdk-pixbuf-d1bda8d56232ff0431796add4029e129f877fd6a.tar.gz |
Fixed some bugs with set_default_size.
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
bugs with set_default_size.
Sat Feb 6 13:23:51 1999 Owen Taylor <otaylor@redhat.com>
* docs/Changes-1.2.txt: Added information about
the change to gtk_widget_size_request().
* gtk/gtkentry.c: Call gtk_widget_get_child_requisition
explicitely since we differentiate between the usize
set by the user and what we got. (Ugh)
* gtk/gtkwidget.[ch] (gtk_widget_get_child_requisition):
New function to return the effective size of a widget
as it looks to its parent.
* gtk/gtkwidget.c (gtk_widget_size_request): Leave
widget->requisition set to exactly what the widget
asked for, and then make a copy of that into
the requisition argument. Allow a NULL requisition
argument, and, if G_ENABLE_DEBUG, warn if
requisition == &widget->requisition.
* gtkalignment.c gtkaspectframe.c gtkbutton.c gtkclist.c
gtkcontainer.c gtkentry.c gtkeventbox.c gtkfixed.c
gtkframe.c gtkhandlebox.c gtkhbox.c gtkhpaned.c
gtklayout.c gtklist.c gtklistitem.c gtkmenu.c
gtkmenubar.c gtkmenuitem.c gtknotebook.c
gtkoptionmenu.c gtkpacker.c gtkscrolledwindow.c
gtktable.c gtktoolbar.c gtktree.c gtktreeitem.c
gtkvbox.c gtkviewport.c gtkvpaned.c gtkwindow.c
Avoid calling gtk_widget_size_request with
requisition == widget->requisition; use
gtk_widget_get_child_requisition to get the
size of children.
Diffstat (limited to 'gtk/gtkwidget.c')
-rw-r--r-- | gtk/gtkwidget.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index b1d507340..09794e0d8 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2346,15 +2346,44 @@ void gtk_widget_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkWidgetAuxInfo *aux_info; - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); +#ifdef G_ENABLE_DEBUG + if (!GTK_WIDGET_TOPLEVEL (widget) && (requisition == &widget->requisition)) + g_warning ("gtk_widget_size_request() called on child widget with widget equal\n to widget->requisition. gtk_widget_set_usize() may not work properly."); +#endif /* G_ENABLE_DEBUG */ + gtk_widget_ref (widget); gtk_widget_ensure_style (widget); gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_REQUEST], - requisition); + &widget->requisition); + + if (requisition) + gtk_widget_get_child_requisition (widget, requisition); + + gtk_widget_unref (widget); +} + +/***************************************** + * gtk_widget_get_requesition: + * + * arguments: + * + * results: + *****************************************/ + +void +gtk_widget_get_child_requisition (GtkWidget *widget, + GtkRequisition *requisition) +{ + GtkWidgetAuxInfo *aux_info; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_WIDGET (widget)); + + *requisition = widget->requisition; + aux_info = gtk_object_get_data_by_id (GTK_OBJECT (widget), aux_info_key_id); if (aux_info) { @@ -2363,7 +2392,6 @@ gtk_widget_size_request (GtkWidget *widget, if (aux_info->height > 0) requisition->height = aux_info->height; } - gtk_widget_unref (widget); } /***************************************** @@ -3462,7 +3490,7 @@ gtk_widget_set_style_internal (GtkWidget *widget, GtkRequisition old_requisition; old_requisition = widget->requisition; - gtk_widget_size_request (widget, &widget->requisition); + gtk_widget_size_request (widget, NULL); if ((old_requisition.width != widget->requisition.width) || (old_requisition.height != widget->requisition.height)) |