[gtk+/wip/animated-scrolling] Fix unmap-during-animation



commit 0ab99316291e217f6e1f8915899476c7536eefa7
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jun 30 11:01:54 2014 -0400

    Fix unmap-during-animation
    
    When disabling animation on unmap, we need to complete a running
    animation and properly unregister from the clock.

 gtk/gtkadjustment.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
index 5171417..a124bac 100644
--- a/gtk/gtkadjustment.c
+++ b/gtk/gtkadjustment.c
@@ -962,13 +962,25 @@ gtk_adjustment_enable_animation (GtkAdjustment *adjustment,
 {
   GtkAdjustmentPrivate *priv = adjustment->priv;
 
-  if (priv->clock)
-    g_object_unref (priv->clock);
+  if (priv->clock != clock)
+    {
+      if (priv->tick_id)
+        {
+          adjustment_set_value (adjustment, priv->target);
 
-  priv->clock = clock;
+          g_signal_handler_disconnect (priv->clock, priv->tick_id);
+          priv->tick_id = 0;
+          gdk_frame_clock_end_updating (priv->clock);
+        }
 
-  if (priv->clock)
-    g_object_ref (priv->clock);
+      if (priv->clock)
+        g_object_unref (priv->clock);
+
+      priv->clock = clock;
+
+      if (priv->clock)
+        g_object_ref (priv->clock);
+    }
 
   priv->duration = duration; 
 }


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