gtkscrolledwindow: Do not try to doubly trigger deceleration
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 28 Feb 2022 19:27:43 +0000 (20:27 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 16 Mar 2022 02:02:45 +0000 (22:02 -0400)
This may come from different sources at around the same time, e.g.
a hold gesture while on overshoot. Avoid doing that if an
animation is already set.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4730
gtk/gtkscrolledwindow.c

index 49be97080c37c04723bfb905207a0126bdd9359b..ee8c2b0ba4ad36c6e03a6cb7e6ace7f1e490330e 100644 (file)
@@ -1052,7 +1052,8 @@ gtk_scrolled_window_decelerate (GtkScrolledWindow *scrolled_window,
 
   if (priv->x_velocity != 0 || priv->y_velocity != 0 || overshoot)
     {
-      gtk_scrolled_window_start_deceleration (scrolled_window);
+      if (priv->deceleration_id == 0)
+        gtk_scrolled_window_start_deceleration (scrolled_window);
       priv->x_velocity = priv->y_velocity = 0;
     }
 }