From 5b1ca9dfa88f6f5e925a2b111928f987a31998e1 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 28 Apr 2011 22:04:31 +0200 Subject: [PATCH] widget: Allow underallocation for scrollables Also document this fact. --- gtk/gtkscrollable.c | 8 ++++++++ gtk/gtkwidget.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/gtkscrollable.c b/gtk/gtkscrollable.c index 0ff0d9612c..7dbaa824d0 100644 --- a/gtk/gtkscrollable.c +++ b/gtk/gtkscrollable.c @@ -45,6 +45,14 @@ * * * + * Because its preferred size is the size for a fully expanded widget, + * the scrollable widget must be able to cope with underallocations. + * This means that it must accept any value passed to its + * #GtkWidgetClass.size_allocate() function. + * + * + * + * * When the parent allocates space to the scrollable child widget, the widget should update * the adjustments' properties with new values. * diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 86e59d3df8..f7094ba9f3 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -4816,7 +4816,8 @@ gtk_widget_size_allocate (GtkWidget *widget, gtk_widget_get_preferred_width_for_height (widget, real_allocation.height, &min_width, &natural_width); } - if (min_width > real_allocation.width || min_height > real_allocation.height) + if ((min_width > real_allocation.width || min_height > real_allocation.height) && + !GTK_IS_SCROLLABLE (widget)) g_warning ("gtk_widget_size_allocate(): attempt to underallocate %s%s %s %p. " "Allocation is %dx%d, but minimum required size is %dx%d.", priv->parent ? G_OBJECT_TYPE_NAME (priv->parent) : "", priv->parent ? "'s child" : "toplevel",