]> Pileus Git - ~andy/gtk/commitdiff
widget: Allow underallocation for scrollables
authorBenjamin Otte <otte@redhat.com>
Thu, 28 Apr 2011 20:04:31 +0000 (22:04 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 28 Apr 2011 20:21:45 +0000 (22:21 +0200)
Also document this fact.

gtk/gtkscrollable.c
gtk/gtkwidget.c

index 0ff0d9612c5d46eb31b2d36de6c5fb828fd0b6b8..7dbaa824d07bb0a17e1cee999fed59cb7bb0d712 100644 (file)
  *   </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>
index 86e59d3df83101e122d03d00cde8b74224656912..f7094ba9f318c9647fb89fbac4e9cf2d3980f68b 100644 (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",