diff options
52 files changed, 284 insertions, 144 deletions
diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c index 622250efd6..0e0d067206 100644 --- a/demos/gtk-demo/offscreen_window.c +++ b/demos/gtk-demo/offscreen_window.c @@ -392,7 +392,8 @@ gtk_rotated_bin_size_request (GtkWidget *widget, child_requisition.height = 0; if (bin->child && gtk_widget_get_visible (bin->child)) - gtk_widget_size_request (bin->child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child), + &child_requisition, NULL); s = sin (bin->angle); c = cos (bin->angle); diff --git a/demos/gtk-demo/offscreen_window2.c b/demos/gtk-demo/offscreen_window2.c index 6e7cceeb4c..d162a360e7 100644 --- a/demos/gtk-demo/offscreen_window2.c +++ b/demos/gtk-demo/offscreen_window2.c @@ -316,7 +316,8 @@ gtk_mirror_bin_size_request (GtkWidget *widget, child_requisition.height = 0; if (bin->child && gtk_widget_get_visible (bin->child)) - gtk_widget_size_request (bin->child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child), + &child_requisition, NULL); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); requisition->width = border_width * 2 + child_requisition.width + 10; diff --git a/docs/reference/gtk/tmpl/gtkcontainer.sgml b/docs/reference/gtk/tmpl/gtkcontainer.sgml index 3218186cd4..ea2ff059f0 100644 --- a/docs/reference/gtk/tmpl/gtkcontainer.sgml +++ b/docs/reference/gtk/tmpl/gtkcontainer.sgml @@ -58,7 +58,7 @@ of their children. <para> The size requisition phase of the widget layout process operates top-down. It starts at a top-level widget, typically a #GtkWindow. The top-level widget -asks its child for its size requisition by calling gtk_widget_size_request(). +asks its child for its size requisition by calling gtk_size_request_get_size(). To determine its requisition, the child asks its own children for their requisitions and so on. Finally, the top-level widget will get a requisition back from its child. diff --git a/docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml b/docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml index 6042343797..4f338198a5 100644 --- a/docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml +++ b/docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml @@ -37,7 +37,7 @@ The #GtkFileChooserButton supports the #GtkFileChooserAction<!-- <para> The #GtkFileChooserButton will ellipsize the label, and thus will thus request little horizontal space. To give the button -more space, you should call gtk_widget_size_request(), +more space, you should call gtk_size_request_get_size(), gtk_file_chooser_button_set_width_chars(), or pack the button in such a way that other interface elements give space to the widget. </para> diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 486bce04b7..475d36af51 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -405,7 +405,8 @@ gtk_accel_label_expose_event (GtkWidget *widget, ac_width = gtk_accel_label_get_accel_width (accel_label); gtk_widget_get_allocation (widget, &allocation); - gtk_widget_size_request (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); if (allocation.width >= requisition.width + ac_width) { diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 334e789202..a866413de8 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -1157,11 +1157,13 @@ gtk_assistant_size_request (GtkWidget *widget, GtkAssistantPage *page = list->data; gint w, h; - gtk_widget_size_request (page->page, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (page->page), + &child_requisition, NULL); width = MAX (width, child_requisition.width); height = MAX (height, child_requisition.height); - gtk_widget_size_request (page->title, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (page->title), + &child_requisition, NULL); w = child_requisition.width; h = child_requisition.height; @@ -1177,16 +1179,19 @@ gtk_assistant_size_request (GtkWidget *widget, list = list->next; } - gtk_widget_size_request (priv->sidebar_image, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sidebar_image), + &child_requisition, NULL); width += child_requisition.width; height = MAX (height, child_requisition.height); gtk_widget_set_size_request (priv->header_image, header_width, header_height); - gtk_widget_size_request (priv->header_image, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header_image), + &child_requisition, NULL); width = MAX (width, header_width) + 2 * header_padding; height += header_height + 2 * header_padding; - gtk_widget_size_request (priv->action_area, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_area), + &child_requisition, NULL); width = MAX (width, child_requisition.width); height += child_requisition.height + ACTION_AREA_SPACING; diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index 5b99cb6949..a5ffe3e4df 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -451,7 +451,8 @@ gtk_button_box_child_requisition (GtkWidget *widget, if (gtk_widget_get_visible (child)) { nchildren += 1; - gtk_widget_size_request (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); avg_w += child_requisition.width + ipad_w; avg_h += child_requisition.height + ipad_h; } diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c index 50dc502751..45c1793979 100644 --- a/gtk/gtkcellrendereraccel.c +++ b/gtk/gtkcellrendereraccel.c @@ -18,15 +18,19 @@ */ #include "config.h" + +#include "gtkcellrendereraccel.h" + +#include "gdk/gdkkeysyms.h" + #include "gtkintl.h" #include "gtkaccelgroup.h" #include "gtkmarshalers.h" -#include "gtkcellrendereraccel.h" #include "gtklabel.h" #include "gtkeventbox.h" #include "gtkmain.h" +#include "gtksizerequest.h" #include "gtkprivate.h" -#include "gdk/gdkkeysyms.h" static void gtk_cell_renderer_accel_get_property (GObject *object, @@ -413,7 +417,8 @@ gtk_cell_renderer_accel_get_size (GtkCellRenderer *cell, if (priv->sizing_label == NULL) priv->sizing_label = gtk_label_new (_("New accelerator...")); - gtk_widget_size_request (priv->sizing_label, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sizing_label), + &requisition, NULL); GTK_CELL_RENDERER_CLASS (gtk_cell_renderer_accel_parent_class)->get_size (cell, widget, cell_area, x_offset, y_offset, width, height); diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c index f0b44453e1..4207e13bf4 100644 --- a/gtk/gtkcellrenderertext.c +++ b/gtk/gtkcellrenderertext.c @@ -18,11 +18,15 @@ */ #include "config.h" -#include <stdlib.h> + #include "gtkcellrenderertext.h" + +#include <stdlib.h> + #include "gtkeditable.h" #include "gtkcellsizerequest.h" #include "gtkentry.h" +#include "gtksizerequest.h" #include "gtkmarshalers.h" #include "gtkintl.h" #include "gtkprivate.h" @@ -1928,8 +1932,9 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell, g_object_set_data_full (G_OBJECT (priv->entry), I_(GTK_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free); gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1); - - gtk_widget_size_request (priv->entry, &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->entry), + &requisition, NULL); if (requisition.height < cell_area->height) { GtkBorder *style_border; diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 35c7e340ee..27659b8bd9 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -238,8 +238,9 @@ gtk_check_button_size_request (GtkWidget *widget, if (child && gtk_widget_get_visible (child)) { GtkRequisition child_requisition; - - gtk_widget_size_request (child, &child_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); requisition->width += child_requisition.width + indicator_spacing; requisition->height += child_requisition.height; diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 117f72e477..098ad335d8 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -26,12 +26,14 @@ */ #include "config.h" + +#include "gtkcolorsel.h" + #include <math.h> #include <string.h> #include "gdkconfig.h" #include "gdk/gdkkeysyms.h" -#include "gtkcolorsel.h" #include "gtkhsv.h" #include "gtkwindow.h" #include "gtkselection.h" @@ -57,6 +59,7 @@ #include "gtksettings.h" #include "gtkstock.h" #include "gtkaccessible.h" +#include "gtksizerequest.h" #include "gtkprivate.h" #include "gtkintl.h" @@ -1357,7 +1360,8 @@ popup_position_func (GtkMenu *menu, gdk_window_get_origin (gtk_widget_get_window (widget), &root_x, &root_y); - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &req, NULL); gtk_widget_get_allocation (widget, &allocation); /* Put corner of menu centered on color cell */ diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 6059e1e445..0734d62721 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -1529,7 +1529,8 @@ gtk_combo_box_menu_position_below (GtkMenu *menu, if (GTK_SHADOW_NONE != combo_box->priv->shadow_type) sx -= gtk_widget_get_style (GTK_WIDGET (combo_box))->xthickness; - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &req, NULL); if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR) *x = sx; @@ -1705,14 +1706,16 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, hpolicy = vpolicy = GTK_POLICY_NEVER; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), hpolicy, vpolicy); - gtk_widget_size_request (priv->scrolled_window, &popup_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->scrolled_window), + &popup_req, NULL); if (popup_req.width > *width) { hpolicy = GTK_POLICY_ALWAYS; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), hpolicy, vpolicy); - gtk_widget_size_request (priv->scrolled_window, &popup_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->scrolled_window), + &popup_req, NULL); } *height = popup_req.height; @@ -2168,7 +2171,8 @@ gtk_combo_box_update_requested_width (GtkComboBox *combo_box, } #define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \ - gtk_widget_size_request (combo_box->priv->button, &req); \ + gtk_size_request_get_size (GTK_SIZE_REQUEST (combo_box->priv->button), \ + &req, NULL); \ \ if (is_rtl) \ child.x = allocation->x + shadow_width; \ @@ -2254,7 +2258,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, /* handle the children */ - gtk_widget_size_request (priv->arrow, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow), + &req, NULL); child.width = req.width; if (!is_rtl) child.x += width - req.width; @@ -2263,7 +2268,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, gtk_widget_size_allocate (priv->arrow, &child); if (is_rtl) child.x += req.width; - gtk_widget_size_request (priv->separator, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->separator), + &req, NULL); child.width = req.width; if (!is_rtl) child.x -= req.width; @@ -2910,7 +2916,8 @@ gtk_cell_view_menu_item_new (GtkComboBox *combo_box, gtk_tree_path_free (path); gtk_combo_box_sync_cells (combo_box, GTK_CELL_LAYOUT (cell_view)); - gtk_widget_size_request (cell_view, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (cell_view), + &req, NULL); gtk_widget_show (cell_view); return item; diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index a4f20efb89..c5f8bd852a 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -25,16 +25,19 @@ */ #include "config.h" + +#include "gtkcontainer.h" + #include <stdarg.h> #include <string.h> #include <stdlib.h> -#include "gtkcontainer.h" #include "gtkbuildable.h" #include "gtkbuilderprivate.h" #include "gtkprivate.h" #include "gtkmain.h" #include "gtkmarshalers.h" +#include "gtksizerequest.h" #include "gtkwindow.h" #include "gtkintl.h" #include "gtktoolbar.h" @@ -1482,8 +1485,9 @@ gtk_container_real_check_resize (GtkContainer *container) GtkWidget *widget = GTK_WIDGET (container); GtkAllocation allocation; GtkRequisition requisition; - - gtk_widget_size_request (widget, &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); gtk_widget_get_allocation (widget, &allocation); if (requisition.width > allocation.width || diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index a1e99c4e98..f9b9a41afa 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -8508,7 +8508,8 @@ popup_position_func (GtkMenu *menu, gtk_menu_set_monitor (menu, monitor_num); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - gtk_widget_size_request (entry->popup_menu, &menu_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (entry->popup_menu), + &menu_req, NULL); gdk_drawable_get_size (entry->text_area, NULL, &height); gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL); _gtk_entry_effective_inner_border (entry, &inner_border); diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 75f2fd22c4..266ff715c6 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -18,7 +18,9 @@ */ #include "config.h" + #include "gtkentrycompletion.h" + #include "gtkentryprivate.h" #include "gtkcelllayout.h" @@ -28,6 +30,7 @@ #include "gtktreeselection.h" #include "gtktreeview.h" #include "gtkscrolledwindow.h" +#include "gtksizerequest.h" #include "gtkvbox.h" #include "gtkwindow.h" #include "gtkentry.h" @@ -1449,9 +1452,11 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) else gtk_widget_hide (completion->priv->action_view); - gtk_widget_size_request (completion->priv->popup_window, &popup_req); - gtk_widget_size_request (completion->priv->entry, &entry_req); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (completion->priv->popup_window), + &popup_req, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (completion->priv->entry), + &entry_req, NULL); + if (x < monitor.x) x = monitor.x; else if (x + popup_req.width > monitor.x + monitor.width) diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c index 70fd1aa68d..b85d727431 100644 --- a/gtk/gtkeventbox.c +++ b/gtk/gtkeventbox.c @@ -25,7 +25,11 @@ */ #include "config.h" + #include "gtkeventbox.h" + +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" @@ -499,8 +503,9 @@ gtk_event_box_size_request (GtkWidget *widget, if (child && gtk_widget_get_visible (child)) { GtkRequisition child_requisition; - - gtk_widget_size_request (child, &child_requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); requisition->width += child_requisition.width; requisition->height += child_requisition.height; diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 3c1b65d3f3..16ecddda52 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -21,6 +21,8 @@ #include "config.h" +#include "gtkfilechooserdefault.h" + #include "gdk/gdkkeysyms.h" #include "gtkalignment.h" #include "gtkbindings.h" @@ -33,7 +35,6 @@ #include "gtkentry.h" #include "gtkexpander.h" #include "gtkfilechooserprivate.h" -#include "gtkfilechooserdefault.h" #include "gtkfilechooserdialog.h" #include "gtkfilechooserembed.h" #include "gtkfilechooserentry.h" @@ -61,6 +62,7 @@ #include "gtkscrolledwindow.h" #include "gtkseparatormenuitem.h" #include "gtksizegroup.h" +#include "gtksizerequest.h" #include "gtkstock.h" #include "gtktable.h" #include "gtktooltip.h" @@ -4107,7 +4109,8 @@ popup_position_func (GtkMenu *menu, gdk_window_get_origin (gtk_widget_get_window (widget), x, y); - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &req, NULL); gtk_widget_get_allocation (widget, &allocation); *x += (allocation.width - req.width) / 2; @@ -7849,20 +7852,23 @@ gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed, impl->preview_widget && gtk_widget_get_visible (impl->preview_widget)) { - gtk_widget_size_request (impl->preview_box, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (impl->preview_box), + &req, NULL); *default_width += PREVIEW_HBOX_SPACING + req.width; } if (impl->extra_widget && gtk_widget_get_visible (impl->extra_widget)) { - gtk_widget_size_request (impl->extra_align, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (impl->extra_align), + &req, NULL); *default_height += gtk_box_get_spacing (GTK_BOX (chooser_embed)) + req.height; } } else { - gtk_widget_size_request (GTK_WIDGET (impl), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (impl), + &req, NULL); *default_width = req.width; *default_height = req.height; } diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index 06818c8c09..bcc8c3bc69 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -20,13 +20,16 @@ */ #include "config.h" -#include "gtkfilechooserprivate.h" + #include "gtkfilechooserdialog.h" + +#include "gtkfilechooserprivate.h" #include "gtkfilechooserwidget.h" #include "gtkfilechooserutils.h" #include "gtkfilechooserembed.h" #include "gtkfilechoosersettings.h" #include "gtkfilesystem.h" +#include "gtksizerequest.h" #include "gtktypebuiltins.h" #include "gtkintl.h" @@ -196,8 +199,10 @@ file_chooser_widget_default_size_changed (GtkWidget *widget, { /* Force a size request of everything before we start. This will make sure * that widget->requisition is meaningful. */ - gtk_widget_size_request (GTK_WIDGET (dialog), &req); - gtk_widget_size_request (widget, &widget_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (dialog), + &req, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &widget_req, NULL); } _gtk_file_chooser_embed_get_default_size (GTK_FILE_CHOOSER_EMBED (priv->widget), diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index a79eece5bb..f23f395f56 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -19,15 +19,18 @@ */ #include "config.h" + +#include "gtkfilechooserentry.h" + #include <string.h> #include "gtkalignment.h" #include "gtkcelllayout.h" #include "gtkcellrenderertext.h" #include "gtkentry.h" -#include "gtkfilechooserentry.h" #include "gtklabel.h" #include "gtkmain.h" +#include "gtksizerequest.h" #include "gtkwindow.h" #include "gtkintl.h" @@ -1023,7 +1026,8 @@ show_completion_feedback_window (GtkFileChooserEntry *chooser_entry) GtkAllocation entry_allocation; int feedback_x, feedback_y; - gtk_widget_size_request (chooser_entry->completion_feedback_window, &feedback_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (chooser_entry->completion_feedback_window), + &feedback_req, NULL); gdk_window_get_origin (gtk_widget_get_window (widget), &entry_x, &entry_y); gtk_widget_get_allocation (widget, &entry_allocation); diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index d7fe2b3a19..9f51864d7a 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -352,7 +352,8 @@ gtk_fixed_size_request (GtkWidget *widget, if (gtk_widget_get_visible (child->widget)) { - gtk_widget_size_request (child->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); requisition->height = MAX (requisition->height, child->y + diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index 4fde9822bd..ee5cfe5b32 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -581,7 +581,10 @@ gtk_handle_box_size_request (GtkWidget *widget, * won't have any useful hint for our size otherwise. */ if (child) - gtk_widget_size_request (child, &child_requisition); + { + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); + } else { child_requisition.width = 0; diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 2dc10434ee..2d97dce272 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -1455,8 +1455,9 @@ gtk_icon_view_size_request (GtkWidget *widget, tmp_list = tmp_list->next; if (gtk_widget_get_visible (child->widget)) - gtk_widget_size_request (child->widget, &child_requisition); - } + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); + } } static void diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index c1e778bde2..311221fe88 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -442,8 +442,8 @@ gtk_image_menu_item_size_request (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_widget_size_request (priv->image, - &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image), + &child_requisition, NULL); child_width = child_requisition.width; child_height = child_requisition.height; diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index ef885f4e57..989968140d 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -6137,7 +6137,8 @@ popup_position_func (GtkMenu *menu, *x += allocation.x; *y += allocation.y; - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &req, NULL); gtk_widget_get_allocation (widget, &allocation); diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index 822d1ecc9e..aad9a04dd2 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -995,7 +995,8 @@ gtk_layout_size_request (GtkWidget *widget, tmp_list = tmp_list->next; - gtk_widget_size_request (child->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); } } diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index 16fbdc5d3a..0211f15c44 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -24,6 +24,8 @@ #include "config.h" +#include "gtklinkbutton.h" + #include <string.h> #include "gtkclipboard.h" @@ -33,12 +35,11 @@ #include "gtkmain.h" #include "gtkmenu.h" #include "gtkmenuitem.h" +#include "gtksizerequest.h" #include "gtkstock.h" #include "gtkshow.h" #include "gtktooltip.h" -#include "gtklinkbutton.h" - #include "gtkintl.h" @@ -368,7 +369,8 @@ popup_position_func (GtkMenu *menu, gdk_window_get_origin (gtk_widget_get_window (widget), x, y); - gtk_widget_size_request (priv->popup_menu, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->popup_menu), + &req, NULL); gtk_widget_get_allocation (widget, &allocation); *x += allocation.width / 2; diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index acc00d09e9..2e809b27de 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -2051,7 +2051,9 @@ gtk_menu_set_tearoff_hints (GtkMenu *menu, if (gtk_widget_get_visible (menu->tearoff_scrollbar)) { GtkRequisition requisition; - gtk_widget_size_request (menu->tearoff_scrollbar, &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu->tearoff_scrollbar), + &requisition, NULL); width += requisition.width; } @@ -2203,8 +2205,9 @@ gtk_menu_set_tearoff_state (GtkMenu *menu, /* Update menu->requisition */ - gtk_widget_size_request (GTK_WIDGET (menu), NULL); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + NULL, NULL); + gtk_menu_set_tearoff_hints (menu, width); gtk_widget_realize (menu->tearoff_window); @@ -5452,7 +5455,8 @@ child_at (GtkMenu *menu, { GtkRequisition child_requisition; - gtk_widget_size_request (children->data, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (children->data), + &child_requisition, NULL); if (_gtk_menu_item_is_selectable (children->data) && child_offset >= lower && diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 26d41ef6e2..b287f8456e 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -311,7 +311,8 @@ gtk_menu_bar_size_request (GtkWidget *widget, gint toggle_size; GTK_MENU_ITEM (child)->show_submenu_indicator = FALSE; - gtk_widget_size_request (child, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_requisition, NULL); gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size); diff --git a/gtk/gtkmenutoolbutton.c b/gtk/gtkmenutoolbutton.c index a7d792b510..bc2b98f702 100644 --- a/gtk/gtkmenutoolbutton.c +++ b/gtk/gtkmenutoolbutton.c @@ -22,12 +22,15 @@ #include "config.h" #include "gtkmenutoolbutton.h" + #include "gtktogglebutton.h" #include "gtkarrow.h" #include "gtkhbox.h" #include "gtkvbox.h" #include "gtkmenu.h" #include "gtkmain.h" +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" @@ -267,7 +270,8 @@ menu_position_func (GtkMenu *menu, GdkScreen *screen; GdkWindow *window; - gtk_widget_size_request (GTK_WIDGET (priv->menu), &menu_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->menu), + &menu_req, NULL); orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button)); direction = gtk_widget_get_direction (widget); @@ -307,7 +311,8 @@ menu_position_func (GtkMenu *menu, else { gdk_window_get_origin (GTK_BUTTON (priv->arrow_button)->event_window, x, y); - gtk_widget_size_request (priv->arrow_button, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), + &req, NULL); gtk_widget_get_allocation (priv->arrow_button, &arrow_allocation); diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 9e9f5854c8..09f8ddeb7a 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1856,8 +1856,9 @@ gtk_notebook_size_request (GtkWidget *widget, if (gtk_widget_get_visible (page->child)) { vis_pages++; - gtk_widget_size_request (page->child, &child_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (page->child), + &child_requisition, NULL); + requisition->width = MAX (requisition->width, child_requisition.width); requisition->height = MAX (requisition->height, @@ -1913,8 +1914,8 @@ gtk_notebook_size_request (GtkWidget *widget, if (!gtk_widget_get_visible (page->tab_label)) gtk_widget_show (page->tab_label); - gtk_widget_size_request (page->tab_label, - &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label), + &child_requisition, NULL); page->requisition.width = child_requisition.width + 2 * style->xthickness; page->requisition.height = child_requisition.height + 2 * style->ythickness; @@ -1949,7 +1950,8 @@ gtk_notebook_size_request (GtkWidget *widget, { if (priv->action_widget[i]) { - gtk_widget_size_request (priv->action_widget[i], &action_widget_requisition[i]); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]), + &action_widget_requisition[i], NULL); action_widget_requisition[i].width += style->xthickness; action_widget_requisition[i].height += style->ythickness; } @@ -2711,7 +2713,8 @@ popup_position_func (GtkMenu *menu, gdk_window_get_origin (gtk_widget_get_window (w), x, y); gtk_widget_get_allocation (w, &allocation); - gtk_widget_size_request (GTK_WIDGET (menu), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &requisition, NULL); if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL) *x += allocation.x + allocation.width - requisition.width; @@ -3331,7 +3334,8 @@ on_drag_icon_expose (GtkWidget *widget, notebook = GTK_WIDGET (data); child = gtk_bin_get_child (GTK_BIN (widget)); - gtk_widget_size_request (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook)); gtk_paint_extension (gtk_widget_get_style (notebook), diff --git a/gtk/gtkoffscreenwindow.c b/gtk/gtkoffscreenwindow.c index bdd29c626c..26bbadb1ec 100644 --- a/gtk/gtkoffscreenwindow.c +++ b/gtk/gtkoffscreenwindow.c @@ -18,8 +18,12 @@ * Alexander Larsson <alexl@redhat.com> */ +#include "config.h" + #include "gtkoffscreenwindow.h" +#include "gtksizerequest.h" + /** * SECTION:gtkoffscreenwindow * @short_description: A toplevel container widget used to manage offscreen @@ -69,7 +73,8 @@ gtk_offscreen_window_size_request (GtkWidget *widget, { GtkRequisition child_req; - gtk_widget_size_request (child, &child_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + &child_req, NULL); requisition->width += child_req.width; requisition->height += child_req.height; @@ -171,7 +176,8 @@ gtk_offscreen_window_resize (GtkWidget *widget) GtkAllocation allocation = { 0, 0 }; GtkRequisition requisition; - gtk_widget_size_request (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); allocation.width = requisition.width; allocation.height = requisition.height; diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 9b2f31254a..e30e18d8cd 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -805,7 +805,8 @@ gtk_paned_size_request (GtkWidget *widget, if (priv->child1 && gtk_widget_get_visible (priv->child1)) { - gtk_widget_size_request (priv->child1, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child1), + &child_requisition, NULL); requisition->height = child_requisition.height; requisition->width = child_requisition.width; @@ -813,7 +814,8 @@ gtk_paned_size_request (GtkWidget *widget, if (priv->child2 && gtk_widget_get_visible (priv->child2)) { - gtk_widget_size_request (priv->child2, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child2), + &child_requisition, NULL); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 479120cbfc..ad03d77ad9 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -334,8 +334,9 @@ gtk_path_bar_size_request (GtkWidget *widget, for (list = path_bar->button_list; list; list = list->next) { button_data = BUTTON_DATA (list->data); - gtk_widget_size_request (button_data->button, &child_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (button_data->button), + &child_requisition, NULL); + if (button_data->type == NORMAL_BUTTON) /* Use 2*Height as button width because of ellipsized label. */ requisition->width = MAX (child_requisition.height * 2, requisition->width); @@ -353,8 +354,10 @@ gtk_path_bar_size_request (GtkWidget *widget, if (path_bar->button_list && path_bar->button_list->next != NULL) requisition->width += (path_bar->spacing + path_bar->slider_width) * 2; - gtk_widget_size_request (path_bar->up_slider_button, &child_requisition); - gtk_widget_size_request (path_bar->down_slider_button, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (path_bar->up_slider_button), + &child_requisition, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (path_bar->down_slider_button), + &child_requisition, NULL); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); requisition->width += border_width * 2; diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index 4281f17ff8..6630019141 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -1411,8 +1411,9 @@ create_application_page (GtkPrintOperation *op) const char *tab_label; /* Make the template the size of the custom widget size request */ - gtk_widget_size_request (op->priv->custom_widget, &requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (op->priv->custom_widget), + &requisition, NULL); + base_units = GetDialogBaseUnits (); baseunitX = LOWORD (base_units); baseunitY = HIWORD (base_units); diff --git a/gtk/gtkrecentchooserdefault.c b/gtk/gtkrecentchooserdefault.c index 9a04611d95..59170fe797 100644 --- a/gtk/gtkrecentchooserdefault.c +++ b/gtk/gtkrecentchooserdefault.c @@ -57,6 +57,7 @@ #include "gtkscrolledwindow.h" #include "gtkseparatormenuitem.h" #include "gtksizegroup.h" +#include "gtksizerequest.h" #include "gtktable.h" #include "gtktreemodelsort.h" #include "gtktreemodelfilter.h" @@ -945,7 +946,8 @@ set_default_size (GtkRecentChooserDefault *impl) height = (impl->icon_size + font_size) * NUM_LINES; /* Use at least the requisition size... */ - gtk_widget_size_request (widget, &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &req, NULL); width = MAX (width, req.width); height = MAX (height, req.height); @@ -1847,7 +1849,8 @@ popup_position_func (GtkMenu *menu, gdk_window_get_origin (gtk_widget_get_window (widget), x, y); - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &req, NULL); gtk_widget_get_allocation (widget, &allocation); *x += (allocation.width - req.width) / 2; diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index d407876e3f..33a2e0d749 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1851,10 +1851,10 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget, natural_req.width = 0; natural_req.height = 0; - gtk_widget_size_request (priv->hscrollbar, - &hscrollbar_requisition); - gtk_widget_size_request (priv->vscrollbar, - &vscrollbar_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->hscrollbar), + &hscrollbar_requisition, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->vscrollbar), + &vscrollbar_requisition, NULL); child = gtk_bin_get_child (bin); if (child && gtk_widget_get_visible (child)) diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c index ed82739e2e..36d3119d8f 100644 --- a/gtk/gtksocket.c +++ b/gtk/gtksocket.c @@ -26,15 +26,18 @@ */ #include "config.h" + +#include "gtksocket.h" + #include <string.h> #include "gdk/gdkkeysyms.h" #include "gtkmain.h" #include "gtkmarshalers.h" +#include "gtksizerequest.h" #include "gtkwindow.h" #include "gtkplug.h" #include "gtkprivate.h" -#include "gtksocket.h" #include "gtksocketprivate.h" #include "gtkdnd.h" #include "gtkintl.h" @@ -457,7 +460,8 @@ gtk_socket_size_request (GtkWidget *widget, if (socket->plug_widget) { - gtk_widget_size_request (socket->plug_widget, requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (socket->plug_widget), + requisition, NULL); } else { diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index 89ce944f3a..e304faf412 100644 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -28,14 +28,16 @@ */ #include "config.h" -#include <string.h> #include "gtkstatusicon.h" +#include <string.h> + #include "gtkintl.h" #include "gtkiconfactory.h" #include "gtkmain.h" #include "gtkmarshalers.h" +#include "gtksizerequest.h" #include "gtktrayicon.h" #include "gtkprivate.h" @@ -2379,7 +2381,8 @@ gtk_status_icon_position_menu (GtkMenu *menu, gdk_window_get_origin (window, x, y); - gtk_widget_size_request (GTK_WIDGET (menu), &menu_req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &menu_req, NULL); gtk_widget_get_allocation (widget, &allocation); if (_gtk_tray_icon_get_orientation (tray_icon) == GTK_ORIENTATION_VERTICAL) diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 39b0a971ae..9de0ab3c71 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -1039,7 +1039,8 @@ gtk_table_size_request_init (GtkTable *table) children = children->next; if (gtk_widget_get_visible (child->widget)) - gtk_widget_size_request (child->widget, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + NULL, NULL); if (child->left_attach == (child->right_attach - 1) && child->xexpand) priv->cols[child->left_attach].expand = TRUE; diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index dcf2f656f2..18d468e1f2 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3312,8 +3312,6 @@ gtk_text_view_size_request (GtkWidget *widget, gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), &old_req, NULL); - gtk_widget_size_request (child->widget, &child_req); - gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), &child_req, NULL); @@ -3327,8 +3325,9 @@ gtk_text_view_size_request (GtkWidget *widget, else { GtkRequisition child_req; - - gtk_widget_size_request (child->widget, &child_req); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_req, NULL); } tmp_list = g_slist_next (tmp_list); @@ -8098,8 +8097,9 @@ popup_position_func (GtkMenu *menu, &cursor_rect); gtk_text_view_get_visible_rect (text_view, &onscreen_rect); - - gtk_widget_size_request (text_view->priv->popup_menu, &req); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (text_view->priv->popup_menu), + &req, NULL); gtk_widget_get_allocation (widget, &allocation); diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index b6abc357e5..8c943c47e8 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -928,8 +928,9 @@ gtk_toolbar_size_request (GtkWidget *widget, if (priv->show_arrow) { - gtk_widget_size_request (priv->arrow_button, &arrow_requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), + &arrow_requisition, NULL); + if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) long_req = arrow_requisition.width; else @@ -2325,9 +2326,9 @@ gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, g_assert (content); g_assert (toolbar_content_is_placeholder (content)); - - gtk_widget_size_request (GTK_WIDGET (priv->highlight_tool_item), - &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->highlight_tool_item), + &requisition, NULL); toolbar_content_set_expand (content, gtk_tool_item_get_expand (tool_item)); @@ -2590,10 +2591,12 @@ menu_position_func (GtkMenu *menu, GdkRectangle monitor; gint monitor_num; GdkScreen *screen; - - gtk_widget_size_request (priv->arrow_button, &req); - gtk_widget_size_request (GTK_WIDGET (menu), &menu_req); - + + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), + &req, NULL); + gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), + &menu_req, NULL); + screen = gtk_widget_get_screen (GTK_WIDGET (menu)); monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (priv->arrow_button)); @@ -3322,8 +3325,8 @@ toolbar_content_size_request (ToolbarContent *content, GtkToolbar *toolbar, GtkRequisition *requisition) { - gtk_widget_size_request (GTK_WIDGET (content->item), - requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (content->item), + requisition, NULL); if (content->is_placeholder && content->disappearing) { diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c index 20ad6d821f..202f385710 100644 --- a/gtk/gtktoolitem.c +++ b/gtk/gtktoolitem.c @@ -22,12 +22,14 @@ #include "config.h" +#include "gtktoolitem.h" + #include <string.h> -#include "gtktoolitem.h" #include "gtkmarshalers.h" #include "gtktoolshell.h" #include "gtkseparatormenuitem.h" +#include "gtksizerequest.h" #include "gtkactivatable.h" #include "gtkintl.h" #include "gtkmain.h" @@ -500,7 +502,8 @@ gtk_tool_item_size_request (GtkWidget *widget, child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) { - gtk_widget_size_request (child, requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child), + requisition, NULL); } else { diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c index b54c22f68e..29ef624ab3 100644 --- a/gtk/gtktoolitemgroup.c +++ b/gtk/gtktoolitemgroup.c @@ -554,7 +554,8 @@ gtk_tool_item_group_size_request (GtkWidget *widget, if (priv->children && gtk_tool_item_group_get_label_widget (group)) { - gtk_widget_size_request (priv->header, requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header), + requisition, NULL); gtk_widget_show (priv->header); } else @@ -687,7 +688,8 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget, GtkRequisition req = {0, 0}; guint width; - gtk_widget_size_request (GTK_WIDGET (child->item), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item), + &req, NULL); width = udiv (req.width, item_size.width); col += width; @@ -745,7 +747,8 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget, GtkRequisition req = {0, 0}; guint width; - gtk_widget_size_request (GTK_WIDGET (child->item), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item), + &req, NULL); width = udiv (req.width, item_size.width); @@ -800,7 +803,8 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget, GtkRequisition req = {0, 0}; guint width; - gtk_widget_size_request (GTK_WIDGET (child->item), &req); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item), + &req, NULL); width = udiv (req.width, item_size.width); col += width; @@ -832,7 +836,8 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_widget_size_request (priv->header, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header), + &child_requisition, NULL); if (GTK_ORIENTATION_VERTICAL == orientation) inquery->height += child_requisition.height; @@ -882,7 +887,8 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget, /* place the header widget */ if (gtk_widget_get_visible (priv->header)) { - gtk_widget_size_request (priv->header, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header), + &child_requisition, NULL); if (GTK_ORIENTATION_VERTICAL == orientation) { @@ -966,7 +972,8 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget, if (!child->homogeneous) { - gtk_widget_size_request (GTK_WIDGET (child->item), &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item), + &child_requisition, NULL); child_requisition.width = MIN (child_requisition.width, item_area.width); } @@ -2297,7 +2304,8 @@ _gtk_tool_item_group_item_size_request (GtkToolItemGroup *group, if (!child->homogeneous && child->expand) new_row = TRUE; - gtk_widget_size_request (GTK_WIDGET (child->item), &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item), + &child_requisition, NULL); if (!homogeneous_only || child->homogeneous) item_size->width = MAX (item_size->width, child_requisition.width); @@ -2383,7 +2391,8 @@ _gtk_tool_item_group_get_size_for_limit (GtkToolItemGroup *group, GtkRequisition requisition; GtkToolItemGroupPrivate* priv = group->priv; - gtk_widget_size_request (GTK_WIDGET (group), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (group), + &requisition, NULL); if (!priv->collapsed || priv->animation_timeout) { diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c index de6d268151..169936edf1 100644 --- a/gtk/gtktoolpalette.c +++ b/gtk/gtktoolpalette.c @@ -365,7 +365,8 @@ gtk_tool_palette_size_request (GtkWidget *widget, if (!group->widget) continue; - gtk_widget_size_request (GTK_WIDGET (group->widget), &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (group->widget), + &child_requisition, NULL); if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation) { diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index ea4375ce74..8808609893 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -21,10 +21,11 @@ #include "config.h" +#include "gtktooltip.h" + #include <math.h> #include <string.h> -#include "gtktooltip.h" #include "gtkintl.h" #include "gtkwindow.h" #include "gtkmain.h" @@ -32,6 +33,7 @@ #include "gtkimage.h" #include "gtkhbox.h" #include "gtkalignment.h" +#include "gtksizerequest.h" #undef DEBUG_TOOLTIP @@ -937,7 +939,8 @@ gtk_tooltip_position (GtkTooltip *tooltip, screen = gtk_widget_get_screen (new_tooltip_widget); - gtk_widget_size_request (GTK_WIDGET (tooltip->current_window), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (tooltip->current_window), + &requisition, NULL); monitor_num = gdk_screen_get_monitor_at_point (screen, tooltip->last_x, diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index f35e96daa3..0be63a7a58 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1972,8 +1972,9 @@ gtk_tree_view_size_request_columns (GtkTreeView *tree_view) continue; column = list->data; - - gtk_widget_size_request (column->button, &requisition); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (column->button), + &requisition, NULL); column->button_request = requisition.width; tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height); } @@ -2066,7 +2067,8 @@ gtk_tree_view_size_request (GtkWidget *widget, tmp_list = tmp_list->next; if (gtk_widget_get_visible (child->widget)) - gtk_widget_size_request (child->widget, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget), + &child_requisition, NULL); } } @@ -6189,7 +6191,8 @@ validate_visible_area (GtkTreeView *tree_view) * same when we get our next size_allocate. If we don't do this, we'll be * in an inconsistent state if we call top_row_to_dy. */ - gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (tree_view), + &requisition, NULL); tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width); tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height); gtk_adjustment_changed (tree_view->priv->hadjustment); @@ -6377,7 +6380,8 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize) * same when we get our next size_allocate. If we don't do this, we'll be * in an inconsistent state when we call top_row_to_dy. */ - gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (tree_view), + &requisition, NULL); tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width); tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height); gtk_adjustment_changed (tree_view->priv->hadjustment); @@ -6440,7 +6444,8 @@ do_presize_handler (GtkTreeView *tree_view) { GtkRequisition requisition; - gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (tree_view), + &requisition, NULL); tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width); tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height); @@ -14271,7 +14276,8 @@ gtk_tree_view_search_position_func (GtkTreeView *tree_view, gdk_drawable_get_size (tree_window, &tree_width, &tree_height); - gtk_widget_size_request (search_dialog, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (search_dialog), + &requisition, NULL); if (tree_x + tree_width > gdk_screen_get_width (screen)) x = gdk_screen_get_width (screen) - requisition.width; @@ -14888,7 +14894,8 @@ gtk_tree_view_real_start_editing (GtkTreeView *tree_view, gtk_tree_view_real_set_cursor (tree_view, path, FALSE, TRUE); cell_area->y += pre_val - (int)tree_view->priv->vadjustment->value; - gtk_widget_size_request (GTK_WIDGET (cell_editable), &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (cell_editable), + &requisition, NULL); GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index fa383f315f..bac96201e9 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -8370,7 +8370,7 @@ gtk_widget_set_size_request (GtkWidget *widget, * @height indicates that that dimension has not been set explicitly * and the natural requisition of the widget will be used intead. See * gtk_widget_set_size_request(). To get the size a widget will - * actually use, call gtk_widget_size_request() instead of + * actually request, call gtk_size_request_get_size() instead of * this function. **/ void diff --git a/gtk/gtkwin32embedwidget.c b/gtk/gtkwin32embedwidget.c index a3061c8bd0..32023f9828 100644 --- a/gtk/gtkwin32embedwidget.c +++ b/gtk/gtkwin32embedwidget.c @@ -189,7 +189,8 @@ gtk_win32_embed_widget_realize (GtkWidget *widget) GtkRequisition requisition; GtkAllocation allocation = { 0, 0, 200, 200 }; - gtk_widget_size_request (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); if (requisition.width || requisition.height) { /* non-empty window */ diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 4993df3734..756266ec16 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -4828,7 +4828,8 @@ gtk_window_realize (GtkWidget *widget) GtkRequisition requisition; GtkAllocation allocation = { 0, 0, 200, 200 }; - gtk_widget_size_request (widget, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + &requisition, NULL); if (requisition.width || requisition.height) { /* non-empty window */ @@ -6032,8 +6033,9 @@ gtk_window_compute_configure_request (GtkWindow *window, widget = GTK_WIDGET (window); screen = gtk_window_check_screen (window); - - gtk_widget_size_request (widget, NULL); + + gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), + NULL, NULL); gtk_window_compute_configure_request_size (window, (guint *)&w, (guint *)&h); gtk_window_compute_hints (window, &new_geometry, &new_flags); @@ -6711,8 +6713,8 @@ gtk_window_constrain_size (GtkWindow *window, } /* Compute the set of geometry hints and flags for a window - * based on the application set geometry, and requisiition - * of the window. gtk_widget_size_request() must have been + * based on the application set geometry, and requisition + * of the window. gtk_size_request_get_size() must have been * called first. */ static void diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c index a458fac79a..0e53bc4ec5 100644 --- a/modules/input/gtkimcontextxim.c +++ b/modules/input/gtkimcontextxim.c @@ -1695,8 +1695,9 @@ on_status_toplevel_configure (GtkWidget *toplevel, gdk_window_get_frame_extents (gtk_widget_get_window (toplevel), &rect); - gtk_widget_size_request (status_window->window, &requisition); - + gtk_size_request_get_size (GTK_SIZE_REQUEST (status_window->window), + &requisition, NULL); + if (rect.y + rect.height + requisition.height < height) y = rect.y + rect.height; else diff --git a/tests/gtkoffscreenbox.c b/tests/gtkoffscreenbox.c index 3bf5fd58a3..eee514b748 100644 --- a/tests/gtkoffscreenbox.c +++ b/tests/gtkoffscreenbox.c @@ -479,7 +479,8 @@ gtk_offscreen_box_size_request (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_widget_size_request (offscreen_box->child1, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child1), + &child_requisition, NULL); w = MAX (w, CHILD1_SIZE_SCALE * child_requisition.width); h += CHILD1_SIZE_SCALE * child_requisition.height; @@ -489,7 +490,8 @@ gtk_offscreen_box_size_request (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_widget_size_request (offscreen_box->child2, &child_requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child2), + &child_requisition, NULL); w = MAX (w, CHILD2_SIZE_SCALE * child_requisition.width); h += CHILD2_SIZE_SCALE * child_requisition.height; diff --git a/tests/testgtk.c b/tests/testgtk.c index 6f0bf104fc..6e40600c8d 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2475,7 +2475,8 @@ create_rotated_text (GtkWidget *widget) gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (window))); gtk_widget_set_size_request (drawing_area, DEFAULT_TEXT_RADIUS * 2, DEFAULT_TEXT_RADIUS * 2); - gtk_widget_size_request (window, &requisition); + gtk_size_request_get_size (GTK_SIZE_REQUEST (window), + &requisition, NULL); gtk_widget_set_size_request (drawing_area, -1, -1); gtk_window_resize (GTK_WINDOW (window), requisition.width, requisition.height); } |