Commit daabd043 authored by Benjamin Otte's avatar Benjamin Otte

range: Remove 2 variables

Instead, compute their value on-demand.
parent 447a4391
...@@ -113,8 +113,6 @@ struct _GtkRangePrivate ...@@ -113,8 +113,6 @@ struct _GtkRangePrivate
gint round_digits; /* Round off value to this many digits, -1 for no rounding */ gint round_digits; /* Round off value to this many digits, -1 for no rounding */
gint slide_initial_slider_position; gint slide_initial_slider_position;
gint slide_initial_coordinate_delta; gint slide_initial_coordinate_delta;
gint slider_start; /* Slider range along the long dimension, in widget->window coords */
gint slider_end;
/* Steppers are: < > ---- < > /* Steppers are: < > ---- < >
* a b c d * a b c d
...@@ -1115,11 +1113,20 @@ gtk_range_get_slider_range (GtkRange *range, ...@@ -1115,11 +1113,20 @@ gtk_range_get_slider_range (GtkRange *range,
gtk_range_calc_layout (range, gtk_adjustment_get_value (priv->adjustment)); gtk_range_calc_layout (range, gtk_adjustment_get_value (priv->adjustment));
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
if (slider_start) if (slider_start)
*slider_start = priv->slider_start; *slider_start = priv->slider.y;
if (slider_end) if (slider_end)
*slider_end = priv->slider_end; *slider_end = priv->slider.y + priv->slider.height;
}
else
{
if (slider_start)
*slider_start = priv->slider.x;
if (slider_end)
*slider_end = priv->slider.x + priv->slider.width;
}
} }
/** /**
...@@ -2662,6 +2669,7 @@ update_slider_position (GtkRange *range, ...@@ -2662,6 +2669,7 @@ update_slider_position (GtkRange *range,
gdouble mark_value; gdouble mark_value;
gdouble mark_delta; gdouble mark_delta;
gdouble zoom; gdouble zoom;
gint slider_start, slider_end;
gint i; gint i;
if (priv->zoom) if (priv->zoom)
...@@ -2697,6 +2705,7 @@ update_slider_position (GtkRange *range, ...@@ -2697,6 +2705,7 @@ update_slider_position (GtkRange *range,
new_value = coord_to_value (range, c); new_value = coord_to_value (range, c);
next_value = coord_to_value (range, c + 1); next_value = coord_to_value (range, c + 1);
mark_delta = fabs (next_value - new_value); mark_delta = fabs (next_value - new_value);
gtk_range_get_slider_range (range, &slider_start, &slider_end);
for (i = 0; i < priv->n_marks; i++) for (i = 0; i < priv->n_marks; i++)
{ {
...@@ -2704,7 +2713,7 @@ update_slider_position (GtkRange *range, ...@@ -2704,7 +2713,7 @@ update_slider_position (GtkRange *range,
if (fabs (gtk_adjustment_get_value (priv->adjustment) - mark_value) < 3 * mark_delta) if (fabs (gtk_adjustment_get_value (priv->adjustment) - mark_value) < 3 * mark_delta)
{ {
if (fabs (new_value - mark_value) < (priv->slider_end - priv->slider_start) * 0.5 * mark_delta) if (fabs (new_value - mark_value) < (slider_end - slider_start) * 0.5 * mark_delta)
{ {
new_value = mark_value; new_value = mark_value;
break; break;
...@@ -3720,10 +3729,6 @@ gtk_range_calc_layout (GtkRange *range, ...@@ -3720,10 +3729,6 @@ gtk_range_calc_layout (GtkRange *range,
priv->slider.y = y; priv->slider.y = y;
priv->slider.height = height; priv->slider.height = height;
/* These are publically exported */
priv->slider_start = priv->slider.y;
priv->slider_end = priv->slider.y + priv->slider.height;
} }
} }
else else
...@@ -3868,10 +3873,6 @@ gtk_range_calc_layout (GtkRange *range, ...@@ -3868,10 +3873,6 @@ gtk_range_calc_layout (GtkRange *range,
priv->slider.x = x; priv->slider.x = x;
priv->slider.width = width; priv->slider.width = width;
/* These are publically exported */
priv->slider_start = priv->slider.x;
priv->slider_end = priv->slider.x + priv->slider.width;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment