range: avoid setting slider coordinates to negative numbers

This can happen if the theme sets a negative margin, but the coordinate
should never be negative.
This commit is contained in:
Cosimo Cecchi 2016-03-04 18:11:30 -08:00
parent fce344d31f
commit f3e068bb31

View File

@ -2617,13 +2617,13 @@ update_initial_slider_position (GtkRange *range,
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
priv->slide_initial_slider_position = slider_alloc->y;
priv->slide_initial_coordinate_delta = y - slider_alloc->y;
priv->slide_initial_slider_position = MAX (0, slider_alloc->y);
priv->slide_initial_coordinate_delta = y - priv->slide_initial_slider_position;
}
else
{
priv->slide_initial_slider_position = slider_alloc->x;
priv->slide_initial_coordinate_delta = x - slider_alloc->x;
priv->slide_initial_slider_position = MAX (0, slider_alloc->x);
priv->slide_initial_coordinate_delta = x - priv->slide_initial_slider_position;
}
}