* src/hildon-pannable-area.c (hildon_pannable_area_size_allocate): Added conditions...
authorAlejandro G. Castro <alex@igalia.com>
Thu, 3 Jul 2008 09:36:27 +0000 (09:36 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Thu, 3 Jul 2008 09:36:27 +0000 (09:36 +0000)
ChangeLog
src/hildon-pannable-area.c

index 3c11f03..1878e6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-07-03  Alejandro G. Castro         <alex@igalia.com>
+
+       * src/hildon-pannable-area.c
+       (hildon_pannable_area_size_allocate): Added conditions to control
+       when overshooting is bigger than the allocated space for the
+       children, this avoids negative allocations.
+
 2008-07-02  Alberto Garcia  <agarcia@igalia.com>
 
        * doc/hildon-docs.sgml
index 7e3316e..ef601e1 100644 (file)
@@ -1481,21 +1481,25 @@ hildon_pannable_area_size_allocate (GtkWidget * widget,
 
   hildon_pannable_area_refresh (HILDON_PANNABLE_AREA (widget));
 
-  child_allocation.width -= (priv->vscroll ? priv->vscroll_rect.width : 0);
-  child_allocation.height -= (priv->hscroll ? priv->hscroll_rect.height : 0);
+  child_allocation.width = MAX (child_allocation.width - (priv->vscroll ?
+                                                          priv->vscroll_rect.width : 0),
+                                0);
+  child_allocation.height = MAX (child_allocation.height - (priv->hscroll ?
+                                                            priv->hscroll_rect.height : 0),
+                                 0);
 
   if (priv->overshot_dist_y > 0) {
     child_allocation.y += priv->overshot_dist_y;
-    child_allocation.height -= priv->overshot_dist_y;
+    child_allocation.height = MAX (child_allocation.height - priv->overshot_dist_y, 0);
   } else if (priv->overshot_dist_y < 0) {
-    child_allocation.height += priv->overshot_dist_y;
+    child_allocation.height = MAX (child_allocation.height + priv->overshot_dist_y, 0);
   }
 
   if (priv->overshot_dist_x > 0) {
     child_allocation.x += priv->overshot_dist_x;
-    child_allocation.width -= priv->overshot_dist_x;
+    child_allocation.width = MAX (child_allocation.width - priv->overshot_dist_x, 0);
   } else if (priv->overshot_dist_x < 0) {
-    child_allocation.width += priv->overshot_dist_x;
+    child_allocation.width = MAX (child_allocation.width + priv->overshot_dist_x, 0);
   }
 
   if (bin->child)