[gtk+] popover: Skip first frame when transitioning



commit 857997be8cbac07d86683c48fb410e4b2e3f1233
Author: Timm Bäder <mail baedert org>
Date:   Sat Sep 3 09:58:27 2016 +0200

    popover: Skip first frame when transitioning
    
    Similar to what we do in GtkStack.

 gtk/gtkpopover.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 6cb4d53..f0579a1 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -176,6 +176,7 @@ struct _GtkPopoverPrivate
   guint transitions_enabled : 1;
   guint state               : 2;
   guint visible             : 1;
+  guint first_frame_skipped : 1;
   gint transition_diff;
   guint tick_id;
 
@@ -551,8 +552,12 @@ show_animate_cb (GtkWidget     *widget,
   GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
   gdouble t;
 
-  gtk_progress_tracker_advance_frame (&priv->tracker,
-                                      gdk_frame_clock_get_frame_time (frame_clock));
+  if (priv->first_frame_skipped)
+    gtk_progress_tracker_advance_frame (&priv->tracker,
+                                        gdk_frame_clock_get_frame_time (frame_clock));
+  else
+    priv->first_frame_skipped = TRUE;
+
   t = gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE);
 
   if (priv->state == STATE_SHOWING)
@@ -609,6 +614,7 @@ gtk_popover_start_transition (GtkPopover *popover)
   if (priv->tick_id != 0)
     return;
 
+  priv->first_frame_skipped = FALSE;
   gtk_progress_tracker_start (&priv->tracker, TRANSITION_DURATION, 0, 1.0);
   priv->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (popover),
                                                 show_animate_cb,


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