[gtk+] GtkSwitch: Initialize offset when beginning animation



commit 5131472984761484c71510d8c588414fa814cc60
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 4 14:35:15 2014 +0200

    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.

 gtk/gtkswitch.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 28962d2..e9b4fcc 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -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",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]