Skip to content

Commit 07d5575

Browse files
author
Philip Withnall
committed
kinetic-scroll-view: Handle ClutterTimeline:stopped not :completed
The former is always emitted when the timeline stops (either due to reaching its duration, or due to clutter_timeline_stop() being called); the latter is only emitted in the first case. Changing signals means we can eliminate manual cleanup code after calls to clutter_timeline_stop(). clutter-project#98
1 parent 63da1f2 commit 07d5575

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

mx/mx-kinetic-scroll-view.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,17 +1087,17 @@ clamp_adjustments (MxKineticScrollView *scroll,
10871087
}
10881088

10891089
static void
1090-
deceleration_completed_cb (ClutterTimeline *timeline,
1091-
MxKineticScrollView *scroll)
1090+
deceleration_stopped_cb (ClutterTimeline *timeline,
1091+
gboolean is_finished,
1092+
MxKineticScrollView *scroll)
10921093
{
10931094
MxKineticScrollViewPrivate *priv = scroll->priv;
10941095
guint duration;
10951096

10961097
duration = (priv->overshoot > 0.0) ? priv->clamp_duration : 10;
10971098
clamp_adjustments (scroll, duration, priv->hmoving, priv->vmoving);
10981099

1099-
g_object_unref (timeline);
1100-
priv->deceleration_timeline = NULL;
1100+
g_clear_object (&priv->deceleration_timeline);
11011101
}
11021102

11031103
static void
@@ -1201,7 +1201,6 @@ deceleration_new_frame_cb (ClutterTimeline *timeline,
12011201
if (stop)
12021202
{
12031203
clutter_timeline_stop (timeline);
1204-
deceleration_completed_cb (timeline, scroll);
12051204
}
12061205
}
12071206
}
@@ -1464,8 +1463,8 @@ release_event (MxKineticScrollView *scroll,
14641463

14651464
g_signal_connect (priv->deceleration_timeline, "new_frame",
14661465
G_CALLBACK (deceleration_new_frame_cb), scroll);
1467-
g_signal_connect (priv->deceleration_timeline, "completed",
1468-
G_CALLBACK (deceleration_completed_cb), scroll);
1466+
g_signal_connect (priv->deceleration_timeline, "stopped",
1467+
G_CALLBACK (deceleration_stopped_cb), scroll);
14691468
priv->accumulated_delta = 0;
14701469
priv->hmoving = priv->vmoving = TRUE;
14711470
clutter_timeline_start (priv->deceleration_timeline);
@@ -1530,9 +1529,6 @@ press_event (MxKineticScrollView *scroll,
15301529
clutter_timeline_stop (priv->deceleration_timeline);
15311530
g_object_unref (priv->deceleration_timeline);
15321531
priv->deceleration_timeline = NULL;
1533-
1534-
clamp_adjustments (scroll, priv->clamp_duration, priv->hmoving,
1535-
priv->vmoving);
15361532
}
15371533

15381534
if (priv->use_captured)

0 commit comments

Comments
 (0)