diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-09-09 15:35:58 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-09-13 21:26:01 +0200 |
commit | 9e81022bf6b7a5c25584b9eeea360cdf38cd6949 (patch) | |
tree | 3b2d02c989bb9042087b384b8637d19dc9e807e2 | |
parent | 153bfacde0d9c7a533c0936f3078db58cf672aac (diff) | |
download | gtk+-9e81022bf6b7a5c25584b9eeea360cdf38cd6949.tar.gz |
Use gtk_size_request_get_size() instead deprecated gtk_widget_get_child_requisition()
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=629177
-rw-r--r-- | gtk/gtkaspectframe.c | 7 | ||||
-rw-r--r-- | gtk/gtkassistant.c | 10 | ||||
-rw-r--r-- | gtk/gtkbbox.c | 7 | ||||
-rw-r--r-- | gtk/gtkcheckbutton.c | 9 | ||||
-rw-r--r-- | gtk/gtkentry.c | 11 | ||||
-rw-r--r-- | gtk/gtkexpander.c | 3 | ||||
-rw-r--r-- | gtk/gtkfixed.c | 7 | ||||
-rw-r--r-- | gtk/gtkfontsel.c | 5 | ||||
-rw-r--r-- | gtk/gtkhandlebox.c | 10 | ||||
-rw-r--r-- | gtk/gtkimagemenuitem.c | 15 | ||||
-rw-r--r-- | gtk/gtklayout.c | 10 | ||||
-rw-r--r-- | gtk/gtkmenubar.c | 18 | ||||
-rw-r--r-- | gtk/gtkmenuitem.c | 3 | ||||
-rw-r--r-- | gtk/gtknotebook.c | 10 | ||||
-rw-r--r-- | gtk/gtkpaned.c | 11 | ||||
-rw-r--r-- | gtk/gtkpathbar.c | 21 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.c | 18 | ||||
-rw-r--r-- | gtk/gtktable.c | 18 | ||||
-rw-r--r-- | gtk/gtktextlayout.c | 5 | ||||
-rw-r--r-- | gtk/gtktextview.c | 16 | ||||
-rw-r--r-- | gtk/gtktoolbar.c | 12 | ||||
-rw-r--r-- | gtk/gtkviewport.c | 5 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 13 | ||||
-rw-r--r-- | tests/gtkoffscreenbox.c | 6 |
24 files changed, 170 insertions, 80 deletions
diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c index 42b709a50f..8eac437807 100644 --- a/gtk/gtkaspectframe.c +++ b/gtk/gtkaspectframe.c @@ -44,7 +44,11 @@ */ #include "config.h" + #include "gtkaspectframe.h" + +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" @@ -348,7 +352,8 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame, { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); if (child_requisition.height != 0) { ratio = ((gdouble) child_requisition.width / diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 5cbfe90214..334e789202 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -58,6 +58,7 @@ #include "gtkimage.h" #include "gtklabel.h" #include "gtksizegroup.h" +#include "gtksizerequest.h" #include "gtkstock.h" #include "gtkintl.h" @@ -1224,7 +1225,8 @@ gtk_assistant_size_allocate (GtkWidget *widget, border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); /* Header */ - gtk_widget_get_child_requisition (priv->header_image, &header_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header_image), + &header_requisition, NULL); header_allocation.x = border_width + header_padding; header_allocation.y = border_width + header_padding; @@ -1234,7 +1236,8 @@ gtk_assistant_size_allocate (GtkWidget *widget, gtk_widget_size_allocate (priv->header_image, &header_allocation); /* Action area */ - gtk_widget_get_child_requisition (priv->action_area, &action_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_area), + &action_requisition, NULL); child_allocation.x = border_width; child_allocation.y = allocation->height - border_width - action_requisition.height; @@ -1247,7 +1250,8 @@ gtk_assistant_size_allocate (GtkWidget *widget, gtk_widget_get_allocation (priv->action_area, &action_area_allocation); /* Sidebar */ - gtk_widget_get_child_requisition (priv->sidebar_image, &sidebar_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sidebar_image), + &sidebar_requisition, NULL); if (rtl) child_allocation.x = allocation->width - border_width - sidebar_requisition.width; diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index 6056e43a88..5b99cb6949 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -45,9 +45,13 @@ */ #include "config.h" + #include "gtkbbox.h" + #include "gtkorientable.h" #include "gtkprivate.h" +#include "gtksizerequest.h" + #include "gtkintl.h" @@ -474,7 +478,8 @@ gtk_button_box_child_requisition (GtkWidget *widget, if (is_secondary) nsecondaries++; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); if (homogeneous || (child_requisition.width + ipad_w < avg_w * 1.5)) { diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 727ad5fcaf..35c7e340ee 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -25,8 +25,12 @@ */ #include "config.h" + #include "gtkcheckbutton.h" + #include "gtklabel.h" +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" @@ -290,8 +294,9 @@ gtk_check_button_size_allocate (GtkWidget *widget, GtkRequisition child_requisition; guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - gtk_widget_get_child_requisition (child, &child_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); + child_allocation.width = MIN (child_requisition.width, allocation->width - ((border_width + focus_width + focus_pad) * 2 diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 7eb25a09aa..a1e99c4e98 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -53,6 +53,7 @@ #include "gtkseparatormenuitem.h" #include "gtkselection.h" #include "gtksettings.h" +#include "gtksizerequest.h" #include "gtkspinbutton.h" #include "gtkstock.h" #include "gtktextutil.h" @@ -2990,7 +2991,8 @@ gtk_entry_get_text_area_size (GtkEntry *entry, gint frame_height; gint xborder, yborder; - gtk_widget_get_child_requisition (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); gtk_widget_get_allocation (widget, &allocation); _gtk_entry_get_borders (entry, &xborder, &yborder); @@ -3044,7 +3046,8 @@ get_widget_window_size (GtkEntry *entry, GtkRequisition requisition; GtkWidget *widget = GTK_WIDGET (entry); - gtk_widget_get_child_requisition (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); gtk_widget_get_allocation (widget, &allocation); if (x) @@ -3106,10 +3109,6 @@ gtk_entry_size_allocate (GtkWidget *widget, if (gtk_widget_get_realized (widget)) { - /* We call gtk_widget_get_child_requisition, since we want (for - * backwards compatibility reasons) the realization here to - * be affected by the usize of the entry, if set - */ gint x, y, width, height; GtkEntryCompletion* completion; diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index bedab00d1e..e8f90bd386 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -451,7 +451,8 @@ gtk_expander_realize (GtkWidget *widget) { GtkRequisition label_requisition; - gtk_widget_get_child_requisition (priv->label_widget, &label_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->label_widget), + &label_requisition, NULL); label_height = label_requisition.height; } else diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index 0a461423f5..d7fe2b3a19 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -25,7 +25,11 @@ */ #include "config.h" + #include "gtkfixed.h" + +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" @@ -398,7 +402,8 @@ gtk_fixed_size_allocate (GtkWidget *widget, if (gtk_widget_get_visible (child->widget)) { - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); child_allocation.x = child->x + border_width; child_allocation.y = child->y + border_width; diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c index 50812d5bc2..40a56f6a56 100644 --- a/gtk/gtkfontsel.c +++ b/gtk/gtkfontsel.c @@ -1173,8 +1173,9 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel) GtkWidget *preview_entry = priv->preview_entry; const gchar *text; - gtk_widget_get_child_requisition (preview_entry, &old_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (preview_entry), + &old_requisition, NULL); + rc_style = gtk_rc_style_new (); rc_style->font_desc = gtk_font_selection_get_font_description (fontsel); diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index 423a4f25ef..4fde9822bd 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -645,7 +645,10 @@ gtk_handle_box_size_allocate (GtkWidget *widget, child = gtk_bin_get_child (bin); if (child) - gtk_widget_get_child_requisition (child, &child_requisition); + { + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); + } else { child_requisition.width = 0; @@ -1379,7 +1382,10 @@ gtk_handle_box_motion (GtkWidget *widget, priv->child_detached = TRUE; if (child) - gtk_widget_get_child_requisition (child, &child_requisition); + { + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); + } else { child_requisition.width = 0; diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index 8c5a63afa3..c1e778bde2 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -25,9 +25,10 @@ */ #include "config.h" + #include "gtkimagemenuitem.h" + #include "gtkaccellabel.h" -#include "gtkintl.h" #include "gtkstock.h" #include "gtkiconfactory.h" #include "gtkimage.h" @@ -35,6 +36,9 @@ #include "gtkcontainer.h" #include "gtkwindow.h" #include "gtkactivatable.h" +#include "gtksizerequest.h" + +#include "gtkintl.h" #include "gtkprivate.h" @@ -341,8 +345,9 @@ gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item, { GtkRequisition image_requisition; guint toggle_spacing; - gtk_widget_get_child_requisition (priv->image, - &image_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image), + &image_requisition, NULL); gtk_widget_style_get (GTK_WIDGET (menu_item), "toggle-spacing", &toggle_spacing, @@ -496,8 +501,8 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget, * come up with a solution that's really better. */ - gtk_widget_get_child_requisition (priv->image, - &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image), + &child_requisition, NULL); gtk_widget_get_allocation (widget, &widget_allocation); diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index fab1875673..822d1ecc9e 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -29,9 +29,13 @@ */ #include "config.h" -#include "gdkconfig.h" #include "gtklayout.h" + +#include "gdkconfig.h" + +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" #include "gtkmarshalers.h" @@ -1124,7 +1128,9 @@ gtk_layout_allocate_child (GtkLayout *layout, allocation.x = child->x; allocation.y = child->y; - gtk_widget_get_child_requisition (child->widget, &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &requisition, NULL); allocation.width = requisition.width; allocation.height = requisition.height; diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 1cc65e60e4..26d41ef6e2 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -25,16 +25,20 @@ */ #include "config.h" + +#include "gtkmenubar.h" + #include "gdk/gdkkeysyms.h" #include "gtkbindings.h" #include "gtkmain.h" #include "gtkmarshalers.h" -#include "gtkmenubar.h" #include "gtkmenuitem.h" #include "gtkmenuprivate.h" #include "gtksettings.h" -#include "gtkintl.h" +#include "gtksizerequest.h" #include "gtkwindow.h" + +#include "gtkintl.h" #include "gtkprivate.h" #define BORDER_SPACING 0 @@ -424,8 +428,9 @@ gtk_menu_bar_size_allocate (GtkWidget *widget, gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size); - gtk_widget_get_child_requisition (child, &child_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); + if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR || priv->child_pack_direction == GTK_PACK_DIRECTION_RTL) child_requisition.width += toggle_size; @@ -474,8 +479,9 @@ gtk_menu_bar_size_allocate (GtkWidget *widget, gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size); - gtk_widget_get_child_requisition (child, &child_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); + if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR || priv->child_pack_direction == GTK_PACK_DIRECTION_RTL) child_requisition.width += toggle_size; diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 733c965bf9..02b3a242de 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -1394,7 +1394,8 @@ gtk_menu_item_size_allocate (GtkWidget *widget, child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); if (menu_item->submenu && menu_item->show_submenu_indicator) { if (direction == GTK_TEXT_DIR_RTL) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 5585d75433..9e9f5854c8 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -27,16 +27,18 @@ #include "config.h" +#include "gtknotebook.h" + #include <stdio.h> #include <string.h> #include <gdk/gdkkeysyms.h> -#include "gtknotebook.h" #include "gtkmain.h" #include "gtkmenu.h" #include "gtkmenuitem.h" #include "gtklabel.h" +#include "gtksizerequest.h" #include "gtkintl.h" #include "gtkmarshalers.h" #include "gtkbindings.h" @@ -2199,7 +2201,8 @@ gtk_notebook_size_allocate (GtkWidget *widget, widget_allocation.y = allocation->y + border_width; is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; - gtk_widget_get_child_requisition (priv->action_widget[i], &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]), + &requisition, NULL); switch (tab_pos) { @@ -5912,7 +5915,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, xthickness = style->xthickness; ythickness = style->ythickness; - gtk_widget_get_child_requisition (page->tab_label, &tab_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label), + &tab_requisition, NULL); gtk_widget_style_get (widget, "focus-line-width", &focus_width, "tab-curvature", &tab_curvature, diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 03f65846d8..9b2f31254a 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -26,13 +26,16 @@ #include "config.h" +#include "gtkpaned.h" + #include "gdk/gdkkeysyms.h" #include "gtkbindings.h" #include "gtkmain.h" #include "gtkmarshalers.h" #include "gtkorientable.h" -#include "gtkpaned.h" +#include "gtksizerequest.h" #include "gtkwindow.h" + #include "gtkprivate.h" #include "gtkintl.h" @@ -884,8 +887,10 @@ gtk_paned_size_allocate (GtkWidget *widget, gtk_widget_style_get (widget, "handle-size", &handle_size, NULL); - gtk_widget_get_child_requisition (priv->child1, &child1_requisition); - gtk_widget_get_child_requisition (priv->child2, &child2_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child1), + &child1_requisition, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child2), + &child2_requisition, NULL); old_handle_pos = priv->handle_pos; diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index bef0f9fb9b..479120cbfc 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -19,8 +19,11 @@ */ #include "config.h" -#include <string.h> + #include "gtkpathbar.h" + +#include <string.h> + #include "gtktogglebutton.h" #include "gtkalignment.h" #include "gtkarrow.h" @@ -33,6 +36,7 @@ #include "gtkhbox.h" #include "gtkmain.h" #include "gtkmarshalers.h" +#include "gtksizerequest.h" enum { @@ -493,7 +497,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget, { child = BUTTON_DATA (list->data)->button; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); width += child_requisition.width + path_bar->spacing; if (list == path_bar->fake_root) @@ -523,7 +528,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget, * button, then count backwards. */ /* Count down the path chain towards the end. */ - gtk_widget_get_child_requisition (BUTTON_DATA (first_button->data)->button, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (BUTTON_DATA (first_button->data)->button), + &child_requisition, NULL); width = child_requisition.width; list = first_button->prev; @@ -531,7 +537,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget, { child = BUTTON_DATA (list->data)->button; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); if (width + child_requisition.width + path_bar->spacing + slider_space > allocation_width) @@ -550,7 +557,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget, { child = BUTTON_DATA (first_button->next->data)->button; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); if (width + child_requisition.width + path_bar->spacing + slider_space > allocation_width) { @@ -597,7 +605,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget, button_data = BUTTON_DATA (list->data); child = button_data->button; - gtk_widget_get_child_requisition (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); child_allocation.width = MIN (child_requisition.width, allocation_width - (path_bar->spacing + path_bar->slider_width) * 2); diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 22beb1bc55..d407876e3f 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1346,8 +1346,8 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget, GtkRequisition vscrollbar_requisition; gboolean is_rtl; - gtk_widget_get_child_requisition (priv->vscrollbar, - &vscrollbar_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->vscrollbar), + &vscrollbar_requisition, NULL); is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; if ((!is_rtl && @@ -1363,8 +1363,9 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget, if (priv->hscrollbar_visible) { GtkRequisition hscrollbar_requisition; - gtk_widget_get_child_requisition (priv->hscrollbar, - &hscrollbar_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->hscrollbar), + &hscrollbar_requisition, NULL); if (priv->real_window_placement == GTK_CORNER_BOTTOM_LEFT || priv->real_window_placement == GTK_CORNER_BOTTOM_RIGHT) @@ -1466,8 +1467,9 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget, if (priv->hscrollbar_visible) { GtkRequisition hscrollbar_requisition; - gtk_widget_get_child_requisition (priv->hscrollbar, - &hscrollbar_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->hscrollbar), + &hscrollbar_requisition, NULL); if (!gtk_widget_get_visible (priv->hscrollbar)) gtk_widget_show (priv->hscrollbar); @@ -1517,8 +1519,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget, if (!gtk_widget_get_visible (priv->vscrollbar)) gtk_widget_show (priv->vscrollbar); - gtk_widget_get_child_requisition (priv->vscrollbar, - &vscrollbar_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->vscrollbar), + &vscrollbar_requisition, NULL); if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && (priv->real_window_placement == GTK_CORNER_TOP_RIGHT || diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 0380aa0c39..39b0a971ae 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -25,8 +25,11 @@ */ #include "config.h" + #include "gtktable.h" + #include "gtkprivate.h" +#include "gtksizerequest.h" #include "gtkintl.h" @@ -1064,7 +1067,9 @@ gtk_table_size_request_pass1 (GtkTable *table) if (gtk_widget_get_visible (child->widget)) { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); /* Child spans a single column. */ @@ -1134,8 +1139,9 @@ gtk_table_size_request_pass3 (GtkTable *table) { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); + /* Check and see if there is already enough space * for the child. */ @@ -1185,7 +1191,8 @@ gtk_table_size_request_pass3 (GtkTable *table) { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); /* Check and see if there is already enough space * for the child. @@ -1662,7 +1669,8 @@ gtk_table_size_allocate_pass2 (GtkTable *table) GtkRequisition child_requisition; guint border_width; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); gtk_widget_get_allocation (GTK_WIDGET (table), &table_allocation); border_width = gtk_container_get_border_width (GTK_CONTAINER (table)); diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 74b3dd3d6b..929810e6a4 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1614,8 +1614,9 @@ add_child_attrs (GtkTextLayout *layout, /* Found it */ GtkRequisition req; - gtk_widget_get_child_requisition (child, &req); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &req, NULL); + width = req.width; height = req.height; diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index e49fb01e71..dcf2f656f2 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3309,11 +3309,13 @@ gtk_text_view_size_request (GtkWidget *widget, GtkRequisition child_req; GtkRequisition old_req; - gtk_widget_get_child_requisition (child->widget, &old_req); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &old_req, NULL); + gtk_widget_size_request (child->widget, &child_req); - gtk_widget_get_child_requisition (child->widget, &child_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_req, NULL); /* Invalidate layout lines if required */ if (priv->layout && @@ -3358,7 +3360,8 @@ gtk_text_view_compute_child_allocation (GtkTextView *text_view, allocation->x = vc->from_left_of_buffer - text_view->priv->xoffset; allocation->y = buffer_y - text_view->priv->yoffset; - gtk_widget_get_child_requisition (vc->widget, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (vc->widget), + &req, NULL); allocation->width = req.width; allocation->height = req.height; } @@ -3459,8 +3462,9 @@ gtk_text_view_allocate_children (GtkTextView *text_view) allocation.x = child->x; allocation.y = child->y; - gtk_widget_get_child_requisition (child->widget, &child_req); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_req, NULL); + allocation.width = child_req.width; allocation.height = child_req.height; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index e3f207e805..b6abc357e5 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -32,6 +32,8 @@ #include "config.h" +#include "gtktoolbar.h" + #include <math.h> #include <string.h> @@ -51,7 +53,7 @@ #include "gtkseparatormenuitem.h" #include "gtkseparatortoolitem.h" #include "gtkstock.h" -#include "gtktoolbar.h" +#include "gtksizerequest.h" #include "gtktoolshell.h" #include "gtkvbox.h" #include "gtkprivate.h" @@ -1454,10 +1456,10 @@ gtk_toolbar_size_allocate (GtkWidget *widget, } border_width += get_internal_padding (toolbar); - - gtk_widget_get_child_requisition (GTK_WIDGET (priv->arrow_button), - &arrow_requisition); - + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), + &arrow_requisition, NULL); + shadow_type = get_shadow_type (toolbar); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 59a5084c5e..1244240ad1 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -443,8 +443,9 @@ viewport_set_hadjustment_values (GtkViewport *viewport, if (child && gtk_widget_get_visible (child)) { GtkRequisition child_requisition; - - gtk_widget_get_child_requisition (child, &child_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); hadjustment->upper = MAX (child_requisition.width, view_allocation.width); } else diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 05ff63d9ab..4993df3734 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5806,7 +5806,8 @@ gtk_window_compute_configure_request_size (GtkWindow *window, if (priv->need_default_size) { - gtk_widget_get_child_requisition (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); /* Default to requisition */ *width = requisition.width; @@ -6727,8 +6728,8 @@ gtk_window_compute_hints (GtkWindow *window, GtkRequisition requisition; widget = GTK_WIDGET (window); - - gtk_widget_get_child_requisition (widget, &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL); geometry_info = gtk_window_get_geometry_info (GTK_WINDOW (widget), FALSE); if (geometry_info) @@ -6758,9 +6759,11 @@ gtk_window_compute_hints (GtkWindow *window, * * Finding these answers would be a bit of a mess here. (Bug #68668) */ - gtk_widget_get_child_requisition (geometry_info->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (geometry_info->widget), + &child_requisition, NULL); - gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); extra_width = requisition.width - child_requisition.width; extra_height = requisition.height - child_requisition.height; } diff --git a/tests/gtkoffscreenbox.c b/tests/gtkoffscreenbox.c index 6a4646966c..3bf5fd58a3 100644 --- a/tests/gtkoffscreenbox.c +++ b/tests/gtkoffscreenbox.c @@ -528,7 +528,8 @@ gtk_offscreen_box_size_allocate (GtkWidget *widget, GtkRequisition child_requisition; GtkAllocation child_allocation; - gtk_widget_get_child_requisition (offscreen_box->child1, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child1), + &child_requisition, NULL); child_allocation.x = child_requisition.width * (CHILD1_SIZE_SCALE - 1.0) / 2; child_allocation.y = start_y + child_requisition.height * (CHILD1_SIZE_SCALE - 1.0) / 2; child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width); @@ -552,7 +553,8 @@ gtk_offscreen_box_size_allocate (GtkWidget *widget, GtkRequisition child_requisition; GtkAllocation child_allocation; - gtk_widget_get_child_requisition (offscreen_box->child2, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child2), + &child_requisition, NULL); child_allocation.x = child_requisition.width * (CHILD2_SIZE_SCALE - 1.0) / 2; child_allocation.y = start_y + child_requisition.height * (CHILD2_SIZE_SCALE - 1.0) / 2; child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width); |