diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2014-07-08 15:35:18 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2014-07-08 19:59:49 +0200 |
commit | 3b658d9fa0766e30a7411d742366d26d8fe4722c (patch) | |
tree | 8cddf7fce1d9d34a2fdc49b7c435a7e037e43782 | |
parent | 4cec2c65713bd1281bd3f84a5ac362c7b26794f2 (diff) | |
download | gtk+-adjustment-animation-fixes.tar.gz |
range: Avoid animations during slider dragadjustment-animation-fixes
If the drag gesture gets a GtkGesture::updated signal, the user
is directly interacting through pointer/touch with the range slider,
animating the adjustment value change in this situation can produce
perceived lag, so set the value immediately when this is happening.
-rw-r--r-- | gtk/gtkrange.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 5f309b9026..84e79fa0bf 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -156,6 +156,9 @@ struct _GtkRangePrivate /* Fill level */ guint show_fill_level : 1; guint restrict_to_fill_level : 1; + + /* Whether dragging is ongoing */ + guint in_drag : 1; }; @@ -2909,6 +2912,7 @@ gtk_range_drag_gesture_update (GtkGestureDrag *gesture, gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y); priv->mouse_x = start_x + offset_x; priv->mouse_y = start_y + offset_y; + priv->in_drag = TRUE; update_autoscroll_mode (range); @@ -2922,6 +2926,7 @@ gtk_range_drag_gesture_end (GtkGestureDrag *gesture, gdouble offset_y, GtkRange *range) { + range->priv->in_drag = FALSE; stop_scrolling (range); } @@ -3997,7 +4002,11 @@ gtk_range_real_change_value (GtkRange *range, priv->need_recalc = TRUE; gtk_widget_queue_draw (GTK_WIDGET (range)); - gtk_adjustment_animate_to_value (priv->adjustment, value); + + if (priv->in_drag) + gtk_adjustment_set_value (priv->adjustment, value); + else + gtk_adjustment_animate_to_value (priv->adjustment, value); } return FALSE; |