GtkSwitch: Initialize offset when beginning animation

handle_x always corresponds to the visible position of the handle,
which is where we want to start the animation. Without this, repeated
keyboard activation will not always animate.
This commit is contained in:
Matthias Clasen 2014-08-04 14:35:15 +02:00
parent 1569952d0e
commit 5131472984

View File

@ -188,6 +188,7 @@ gtk_switch_begin_toggle_animation (GtkSwitch *sw)
GdkFrameClock *clock = gtk_widget_get_frame_clock (GTK_WIDGET (sw));
priv->start_time = gdk_frame_clock_get_frame_time (clock);
priv->end_time = priv->start_time + 1000 * ANIMATION_DURATION;
priv->offset = priv->handle_x;
if (priv->tick_id == 0)
{
priv->tick_id = g_signal_connect (clock, "update",