diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2014-11-17 16:55:08 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2014-11-17 16:55:08 +0100 |
commit | 76510619206ae8233ed49b379343b689a8028920 (patch) | |
tree | a1cf8404c4ef4d5f25315d158710f2185e9f52d3 | |
parent | 6d5f2ff87ebdf9abcbf70c7fb26348fca2a612ae (diff) | |
download | gtk+-76510619206ae8233ed49b379343b689a8028920.tar.gz |
scrolledwindow: Avoid too frequent redraws of scrollbars
When overshooting through touchpad kinetic scrolling, the scrollbar remains
mostly static as it already hit a boundary. However, the fade in/out checks
are constantly run during scroll events, causing needless redraws in this
specific case.
-rw-r--r-- | gtk/gtkscrolledwindow.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 3d33d600b4..86a53d75fb 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -3387,7 +3387,9 @@ static void indicator_set_fade (Indicator *indicator, gdouble pos) { - gboolean visible; + gboolean visible, changed; + + changed = indicator->current_pos != pos; indicator->current_pos = pos; visible = indicator->current_pos != 0.0 || indicator->target_pos != 0.0; @@ -3404,8 +3406,11 @@ indicator_set_fade (Indicator *indicator, indicator->conceil_timer = 0; } - gtk_widget_set_opacity (indicator->scrollbar, indicator->current_pos); - gtk_widget_queue_draw (indicator->scrollbar); + if (changed) + { + gtk_widget_set_opacity (indicator->scrollbar, indicator->current_pos); + gtk_widget_queue_draw (indicator->scrollbar); + } } static double |