range: Treat lower and upper limit the same

When clamping values to be within the range of
the adjustment, treat the lower and upper limit
the same.

Fixes: #328
This commit is contained in:
Matthias Clasen 2020-05-21 20:37:54 -04:00
parent 3b8bd265a3
commit e9872d52d8

View File

@ -1746,9 +1746,9 @@ coord_to_value (GtkRange *range,
else
{
if (priv->slider_size_fixed)
frac = MAX (0, coord) / (double) (trough_length);
frac = CLAMP (coord / (double) trough_length, 0, 1);
else
frac = MAX (0, coord) / (double) (trough_length - slider_length);
frac = CLAMP (coord / (double) (trough_length - slider_length), 0, 1);
}
if (should_invert (range))