[gtk+] range: Redraw when slider visiblity changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] range: Redraw when slider visiblity changes
- Date: Thu, 5 Nov 2015 12:26:53 +0000 (UTC)
commit 2e314940af267852271425ab49ead85eb12bfca6
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 5 07:23:54 2015 -0500
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.
gtk/gtkrange.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index ceecafa..cae8592 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]