Increase default value of HildonPannableArea:velocity_max to 2000
[hildon] / hildon / hildon-pannable-area.c
index ddccd47..83a2b24 100644 (file)
@@ -401,7 +401,7 @@ hildon_pannable_area_class_init (HildonPannableAreaClass * klass)
                                                        "Maximum scroll velocity",
                                                        "Maximum distance the child widget should scroll "
                                                        "per 'frame', in pixels per frame.",
-                                                       0, G_MAXDOUBLE, 500,
+                                                       0, G_MAXDOUBLE, 2000,
                                                        G_PARAM_READWRITE |
                                                        G_PARAM_CONSTRUCT));
 
@@ -411,7 +411,7 @@ hildon_pannable_area_class_init (HildonPannableAreaClass * klass)
                                                        "Maximum scroll velocity when overshooting",
                                                        "Maximum distance the child widget should scroll "
                                                        "per 'frame', in pixels per frame when it overshoots after hitting the edge.",
-                                                       0, G_MAXDOUBLE, 20,
+                                                       0, G_MAXDOUBLE, 130,
                                                        G_PARAM_READWRITE |
                                                        G_PARAM_CONSTRUCT));
 
@@ -1223,6 +1223,8 @@ hildon_pannable_area_size_allocate (GtkWidget * widget,
 
   if (child && GTK_WIDGET_VISIBLE (child)) {
 
+    hildon_pannable_area_check_scrollbars (HILDON_PANNABLE_AREA (widget));
+
     hildon_pannable_area_child_allocate_calculate (widget,
                                                    allocation,
                                                    &child_allocation);
@@ -1979,6 +1981,8 @@ hildon_pannable_area_button_press_cb (GtkWidget * widget,
                               (gpointer) & priv->child);
 
     event = (GdkEventButton *) gdk_event_copy ((GdkEvent *) event);
+    /* remove the reference we added with the copy */
+    g_object_unref (priv->event_window);
     event->x = x;
     event->y = y;
     priv->cx = x;
@@ -2165,7 +2169,7 @@ hildon_pannable_axis_scroll (HildonPannableArea *area,
           *vel *= -1;
         } else if ((*overshooting > 1) && (*vel < 0)) {
           /* we add the MIN in order to avoid very small speeds */
-          *vel = MIN ((((gdouble)*overshot_dist)*0.4) * -1, -2.0);
+          *vel = MIN (((((gdouble)*overshot_dist)*0.8) * -1), -10.0);
         }
 
         *overshot_dist = CLAMP (*overshot_dist + *vel, 0, overshoot_max);
@@ -2181,7 +2185,7 @@ hildon_pannable_axis_scroll (HildonPannableArea *area,
           *vel *= -1;
         } else if ((*overshooting > 1) && (*vel > 0)) {
           /* we add the MAX in order to avoid very small speeds */
-          *vel = MAX ((((gdouble)*overshot_dist)*0.4) * -1, 2.0);
+          *vel = MAX (((((gdouble)*overshot_dist)*0.8) * -1), 10.0);
         }
 
         *overshot_dist = CLAMP (*overshot_dist + (*vel), -overshoot_max, 0);
@@ -2497,10 +2501,10 @@ hildon_pannable_area_check_move (HildonPannableArea *area,
        (priv->mode != HILDON_PANNABLE_AREA_MODE_AUTO)) {
 
       if (!priv->idle_id)
-        priv->idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS-10,
-                                                      (guint)(1000.0 / (gdouble) priv->sps),
-                                                      (GSourceFunc)hildon_pannable_area_timeout,
-                                                      area, NULL);
+        priv->idle_id = gdk_threads_add_timeout ((gint)
+                                                 (1000.0 / (gdouble) priv->sps),
+                                                 (GSourceFunc)
+                                                 hildon_pannable_area_timeout, area);
     }
   }
 }
@@ -2638,6 +2642,8 @@ hildon_pannable_area_motion_notify_cb (GtkWidget * widget,
   if (priv->child) {
     /* Send motion notify to child */
     event = (GdkEventMotion *) gdk_event_copy ((GdkEvent *) event);
+    /* remove the reference we added with the copy */
+    g_object_unref (priv->event_window);
     event->x = priv->cx + (event->x - priv->ix);
     event->y = priv->cy + (event->y - priv->iy);
     event->window = g_object_ref (priv->child);
@@ -2715,12 +2721,12 @@ hildon_pannable_area_button_release_cb (GtkWidget * widget,
   /* If overshoot has been initiated with a finger down, on release set max speed */
   if (priv->overshot_dist_y != 0) {
     priv->overshooting_y = priv->bounce_steps; /* Hack to stop a bounce in the finger down case */
-    priv->vel_y = priv->vmax_overshooting;
+    priv->vel_y = priv->overshot_dist_y * 0.9;
   }
 
   if (priv->overshot_dist_x != 0) {
     priv->overshooting_x = priv->bounce_steps; /* Hack to stop a bounce in the finger down case */
-    priv->vel_x = priv->vmax_overshooting;
+    priv->vel_x = priv->overshot_dist_x * 0.9;
   }
 
   priv->button_pressed = FALSE;
@@ -2746,10 +2752,9 @@ hildon_pannable_area_button_release_cb (GtkWidget * widget,
       priv->vel_y = (priv->vel_y > 0) ? priv->vmax : -priv->vmax;
 
     if (!priv->idle_id)
-      priv->idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS-10,
-                                                    (guint)(1000.0 / (gdouble) priv->sps),
-                                                    (GSourceFunc)hildon_pannable_area_timeout,
-                                                    area, NULL);
+      priv->idle_id = gdk_threads_add_timeout ((gint) (1000.0 / (gdouble) priv->sps),
+                                               (GSourceFunc)
+                                               hildon_pannable_area_timeout, widget);
   } else {
     if (priv->center_on_child_focus_pending) {
       hildon_pannable_area_center_on_child_focus (area);
@@ -2780,6 +2785,8 @@ hildon_pannable_area_button_release_cb (GtkWidget * widget,
                                      event->x, event->y, &x, &y, GDK_BUTTON_RELEASE_MASK);
 
   event = (GdkEventButton *) gdk_event_copy ((GdkEvent *) event);
+  /* remove the reference we added with the copy */
+  g_object_unref (priv->event_window);
   event->x = x;
   event->y = y;
 
@@ -3194,10 +3201,9 @@ hildon_pannable_area_scroll_to (HildonPannableArea *area,
   hildon_pannable_area_launch_fade_timeout (area, 1.0);
 
   if (!priv->idle_id)
-    priv->idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS-10,
-                                                  (guint)(1000.0 / (gdouble) priv->sps),
-                                                  (GSourceFunc)hildon_pannable_area_timeout,
-                                                  area, NULL);
+    priv->idle_id = gdk_threads_add_timeout ((gint) (1000.0 / (gdouble) priv->sps),
+                                             (GSourceFunc)
+                                             hildon_pannable_area_timeout, area);
 }
 
 /**