summaryrefslogtreecommitdiff
path: root/gtk/gtkprogressbar.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-11-11 07:24:35 -0500
committerMatthias Clasen <mclasen@redhat.com>2013-11-11 07:24:35 -0500
commit10cd226dfe5fcfd277f9b1986b649bb0617b6b36 (patch)
tree5ce8948791d1adb9fd547e660559353e9aa1bb11 /gtk/gtkprogressbar.c
parentea70c77867cf88c26ebc44209c4751b79e8c5ccc (diff)
downloadgtk+-10cd226dfe5fcfd277f9b1986b649bb0617b6b36.tar.gz
Progress bar: Handle 'no more pulse'
Before smooth animation, stopping the pulse would abruptly stop the bouncy bar. This change makes it so that we slow down for a bit, and then stop.
Diffstat (limited to 'gtk/gtkprogressbar.c')
-rw-r--r--gtk/gtkprogressbar.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 00080bb3fd..5e3a47d306 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -588,11 +588,17 @@ tick_cb (GtkWidget *widget,
g_assert (priv->pulse2 > priv->pulse1);
g_assert (frame2 > priv->frame1);
+ if (frame2 - priv->pulse2 > 3 * (priv->pulse2 - priv->pulse1))
+ {
+ priv->pulse1 = 0;
+ return G_SOURCE_CONTINUE;
+ }
+
/* Determine the fraction to move the block from one frame
* to the next when pulse_fraction is how far the block should
* move between two calls to gtk_progress_bar_pulse().
*/
- fraction = priv->pulse_fraction * (frame2 - priv->frame1) / (priv->pulse2 - priv->pulse1);
+ fraction = priv->pulse_fraction * (frame2 - priv->frame1) / MAX (frame2 - priv->pulse2, priv->pulse2 - priv->pulse1);
priv->frame1 = frame2;