range: don't trim the trough rectange by the trough margin

Commit e32da246a8 made GtkRange's trough
respect the CSS margin property, but it also trimmed the box in which
the trough reacts to click events by the margin.
We still want to catch events in that area instead, and just make sure
the margin is applied when drawing (which was already implemented by
that commit).

This commit reverts the parts of
e32da246a8 that didn't involve drawing,
fixing the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=691677
This commit is contained in:
Cosimo Cecchi 2013-01-14 10:09:10 -05:00
parent 376e8d568e
commit aa77cd6501

View File

@ -3748,16 +3748,16 @@ gtk_range_calc_layout (GtkRange *range,
/* Now the trough is the remaining space between steppers B and C, /* Now the trough is the remaining space between steppers B and C,
* if any, minus spacing * if any, minus spacing
*/ */
priv->trough.x = range_rect.x + trough_margin.left; priv->trough.x = range_rect.x;
priv->trough.y = priv->stepper_b.y + priv->stepper_b.height + stepper_spacing * has_steppers_ab + trough_margin.top; priv->trough.y = priv->stepper_b.y + priv->stepper_b.height + stepper_spacing * has_steppers_ab;
priv->trough.width = range_rect.width - trough_margin.left - trough_margin.right; priv->trough.width = range_rect.width;
priv->trough.height = priv->stepper_c.y - priv->trough.y - stepper_spacing * has_steppers_cd - trough_margin.bottom; priv->trough.height = priv->stepper_c.y - priv->trough.y - stepper_spacing * has_steppers_cd;
/* Slider fits into the trough, with stepper_spacing on either side, /* Slider fits into the trough, with stepper_spacing on either side,
* and the size/position based on the adjustment or fixed, depending. * and the size/position based on the adjustment or fixed, depending.
*/ */
priv->slider.x = range_rect.x + focus_width + trough_border; priv->slider.x = priv->trough.x + focus_width + trough_border;
priv->slider.width = range_rect.width - (focus_width + trough_border) * 2; priv->slider.width = priv->trough.width - (focus_width + trough_border) * 2;
/* Compute slider position/length */ /* Compute slider position/length */
{ {
@ -3896,16 +3896,16 @@ gtk_range_calc_layout (GtkRange *range,
/* Now the trough is the remaining space between steppers B and C, /* Now the trough is the remaining space between steppers B and C,
* if any * if any
*/ */
priv->trough.x = priv->stepper_b.x + priv->stepper_b.width + stepper_spacing * has_steppers_ab + trough_margin.left; priv->trough.x = priv->stepper_b.x + priv->stepper_b.width + stepper_spacing * has_steppers_ab;
priv->trough.y = range_rect.y + trough_margin.top; priv->trough.y = range_rect.y;
priv->trough.width = priv->stepper_c.x - priv->trough.x - stepper_spacing * has_steppers_cd - trough_margin.right; priv->trough.width = priv->stepper_c.x - priv->trough.x - stepper_spacing * has_steppers_cd;
priv->trough.height = range_rect.height - trough_margin.top - trough_margin.bottom; priv->trough.height = range_rect.height;
/* Slider fits into the trough, with stepper_spacing on either side, /* Slider fits into the trough, with stepper_spacing on either side,
* and the size/position based on the adjustment or fixed, depending. * and the size/position based on the adjustment or fixed, depending.
*/ */
priv->slider.y = range_rect.y + focus_width + trough_border; priv->slider.y = priv->trough.y + focus_width + trough_border;
priv->slider.height = range_rect.height - (focus_width + trough_border) * 2; priv->slider.height = priv->trough.height - (focus_width + trough_border) * 2;
/* Compute slider position/length */ /* Compute slider position/length */
{ {