widget: Allow underallocation for scrollables

Also document this fact.
This commit is contained in:
Benjamin Otte
2011-04-28 22:04:31 +02:00
parent 2eac1ac73b
commit 5b1ca9dfa8
2 changed files with 10 additions and 1 deletions

View File

@@ -45,6 +45,14 @@
* </listitem>
* <listitem>
* <para>
* 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.
* </para>
* </listitem>
* <listitem>
* <para>
* When the parent allocates space to the scrollable child widget, the widget should update
* the adjustments' properties with new values.
* </para>

View File

@@ -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",