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.
This commit is contained in:
Matthias Clasen 2015-11-05 07:23:54 -05:00
parent 8afb4a69e8
commit 2e314940af

View File

@ -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;