* src/hildon-pannable-area.c, (hildon_pannable_area_scroll): Added clause to stop...
authorAlejandro G. Castro <alex@igalia.com>
Thu, 9 Oct 2008 11:58:34 +0000 (11:58 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Thu, 9 Oct 2008 11:58:34 +0000 (11:58 +0000)
Fixes: NB#89632 (Picker button selection doesn't change on first click)

ChangeLog
src/hildon-pannable-area.c

index b582b04..80f7cb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-10-09  Alejandro G. Castro         <alex@igalia.com>
+
+       * src/hildon-pannable-area.c,
+       (hildon_pannable_area_scroll): Added clause to stop movement when
+       the child of pannable is smaller than one page.
+       (hildon_pannable_area_scroll_to): Added conditions to avoid
+       starting the scrolling movement if the child is smaller than one
+       page, the complete child is in the screen, we do not have to move.
+
+       Fixes: NB#89632 (Picker button selection doesn't change on first click)
+
 2008-10-09  Alberto Garcia  <agarcia@igalia.com>
 
        * src/hildon-app-menu.c: Removed the 'columns' property, as now
index 673fb12..9a45111 100644 (file)
@@ -1594,12 +1594,16 @@ hildon_pannable_area_scroll (HildonPannableArea *area,
     hildon_pannable_axis_scroll (area, priv->vadjust, &priv->vel_y, y,
                                  &priv->overshooting_y, &priv->overshot_dist_y,
                                  &priv->scroll_to_y, priv->vovershoot_max, &sy);
+  } else {
+    priv->vel_y = 0;
   }
 
   if (hscroll_visible) {
     hildon_pannable_axis_scroll (area, priv->hadjust, &priv->vel_x, x,
                                  &priv->overshooting_x, &priv->overshot_dist_x,
                                  &priv->scroll_to_x, priv->hovershoot_max, &sx);
+  } else {
+    priv->vel_x = 0;
   }
 
   /* If the scroll on a particular axis wasn't succesful, reset the
@@ -2182,20 +2186,25 @@ hildon_pannable_area_scroll_to (HildonPannableArea *area,
   HildonPannableAreaPrivate *priv;
   gint width, height;
   gint dist_x, dist_y;
+  gboolean hscroll_visible, vscroll_visible;
 
   g_return_if_fail (HILDON_IS_PANNABLE_AREA (area));
 
   priv = PANNABLE_AREA_PRIVATE (area);
 
-  if (priv->mode == HILDON_PANNABLE_AREA_MODE_PUSH)
-    hildon_pannable_area_jump_to (area, x, y);
-
-  g_return_if_fail (x >= -1 && y >= -1);
+  vscroll_visible = (priv->vadjust->upper - priv->vadjust->lower >
+            priv->vadjust->page_size);
+  hscroll_visible = (priv->hadjust->upper - priv->hadjust->lower >
+            priv->hadjust->page_size);
 
-  if (x == -1 && y == -1) {
+  if (((!vscroll_visible)&&(!hscroll_visible)) ||
+      (x == -1 && y == -1)) {
     return;
   }
 
+  if (priv->mode == HILDON_PANNABLE_AREA_MODE_PUSH)
+    hildon_pannable_area_jump_to (area, x, y);
+
   width = priv->hadjust->upper - priv->hadjust->lower;
   height = priv->vadjust->upper - priv->vadjust->lower;