+2008-07-04 Alejandro G. Castro <alex@igalia.com>
+
+ * src/hildon-pannable-area.c,
+ (hildon_pannable_area_get_topmost): replaced
+ gdk_window_get_children with gdk_window_peek_children, this way we
+ do not have to free the list because it is not a copy.
+
+ (hildon_pannable_axis_scroll),
+ (hildon_pannable_area_scroll),
+ (hildon_pannable_area_timeout),
+ (hildon_pannable_area_motion_notify_cb): Code refactoring, removed
+ two parameters that were only used inside the
+ hildon_pannable_area_scroll function.
+
+ * examples/hildon-pannable-area-example.c,
+ (get_sawtooth_label): Fixed small memory leak.
+
2008-07-03 Alejandro G. Castro <alex@igalia.com>
More checks for the case where the overshoot is bigger than the
while (window) {
gint child_x = 0, child_y = 0;
- GList *c, *children = gdk_window_get_children (window);
+ GList *c, *children = gdk_window_peek_children (window);
GdkWindow *old_window = window;
for (c = children; c; c = c->next) {
}
}
- g_list_free (children);
-
/*g_debug ("\\|/"); */
if (window == old_window)
break;
*vel = 0;
}
}
-
- if (s) {
- *s = TRUE;
- }
}
gtk_adjustment_set_value (adjust, dist);
} else {
if (!priv->clicked) {
- if (s) *s = TRUE;
/* When the overshoot has started we continue for BOUNCE_STEPS more steps into the overshoot
* before we reverse direction. The deceleration factor is calculated based on
static void
hildon_pannable_area_scroll (HildonPannableArea *area,
- gdouble x, gdouble y,
- gboolean *sx, gboolean *sy)
+ gdouble x, gdouble y)
{
+ gboolean sx, sy;
HildonPannableAreaPrivate *priv;
gboolean hscroll, vscroll;
hscroll = (priv->hadjust->upper - priv->hadjust->lower >
priv->hadjust->page_size) ? TRUE : FALSE;
+ sx = TRUE;
+ sy = TRUE;
+
if (vscroll) {
hildon_pannable_axis_scroll (area, priv->vadjust, &priv->vel_y, y,
&priv->overshooting_y, &priv->overshot_dist_y,
- &priv->scroll_to_y, sy);
+ &priv->scroll_to_y, &sy);
}
if (hscroll) {
hildon_pannable_axis_scroll (area, priv->hadjust, &priv->vel_x, x,
&priv->overshooting_x, &priv->overshot_dist_x,
- &priv->scroll_to_x, sx);
+ &priv->scroll_to_x, &sx);
}
/* If the scroll on a particular axis wasn't succesful, reset the
* initial scroll position to the new mouse co-ordinate. This means
* when you get to the top of the page, dragging down works immediately.
*/
- if ((sx)&&(!(*sx))) {
+ if (!sx) {
priv->x = priv->ex;
}
- if ((sy)&&(!(*sy))) {
+ if (!sy) {
priv->y = priv->ey;
}
static gboolean
hildon_pannable_area_timeout (HildonPannableArea * area)
{
- gboolean sx, sy;
HildonPannableAreaPrivate *priv;
GDK_THREADS_ENTER ();
return FALSE;
}
- hildon_pannable_area_scroll (area, priv->vel_x, priv->vel_y, &sx, &sy);
+ hildon_pannable_area_scroll (area, priv->vel_x, priv->vel_y);
GDK_THREADS_LEAVE ();
/* Scroll by the amount of pixels the cursor has moved
* since the last motion event.
*/
- hildon_pannable_area_scroll (area, x, y, NULL, NULL);
+ hildon_pannable_area_scroll (area, x, y);
priv->x = event->x;
priv->y = event->y;
break;
priv->vel_y = priv->vel_y > 0 ? MIN (priv->vel_y, priv->vmax)
: MAX (priv->vel_y, -1 * priv->vmax);
- hildon_pannable_area_scroll (area, x, y, NULL, NULL);
+ hildon_pannable_area_scroll (area, x, y);
priv->x = event->x;
priv->y = event->y;