diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-11-05 07:23:54 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-11-05 07:26:10 -0500 |
commit | 2e314940af267852271425ab49ead85eb12bfca6 (patch) | |
tree | 57169bb6e33ac932446031c653ca6b7e53a67f7c /gtk/gtkrange.c | |
parent | 8afb4a69e863db563a662bb8c5b2858b53c287ef (diff) | |
download | gtk+-2e314940af267852271425ab49ead85eb12bfca6.tar.gz |
range: Redraw when slider visiblity changes
We were not queuing a draw (and not updating the CSS node) when
the slider visibility changed. This was exposed by the Trough
button in tests/testscale.
Fix this by taking slider visibility into account when deciding
whether to queue a draw in response to adjustment changes.
Diffstat (limited to 'gtk/gtkrange.c')
-rw-r--r-- | gtk/gtkrange.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index ceecafa935..cae85924b1 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -3623,14 +3623,24 @@ gtk_range_calc_slider (GtkRange *range) { GtkRangePrivate *priv = range->priv; GdkRectangle new_slider; + gboolean visible; - gtk_range_compute_slider_position (range, + if (GTK_IS_SCALE (range) && + gtk_adjustment_get_upper (priv->adjustment) == gtk_adjustment_get_lower (priv->adjustment)) + visible = FALSE; + else + visible = TRUE; + + gtk_range_compute_slider_position (range, gtk_adjustment_get_value (priv->adjustment), &new_slider); - if (gdk_rectangle_equal (&priv->slider, &new_slider)) + if (gdk_rectangle_equal (&priv->slider, &new_slider) && + visible == gtk_css_node_get_visible (priv->slider_node)) return; + gtk_css_node_set_visible (priv->slider_node, visible); + gtk_range_queue_draw_location (range, MOUSE_SLIDER); priv->slider = new_slider; |