]> Pileus Git - ~andy/gtk/commitdiff
range: don't trim the trough rectange by the trough margin
authorCosimo Cecchi <cosimoc@gnome.org>
Mon, 14 Jan 2013 15:09:10 +0000 (10:09 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Mon, 14 Jan 2013 15:20:43 +0000 (10:20 -0500)
Commit e32da246a84492f02b4dac5a448bb46cb23d68b8 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
e32da246a84492f02b4dac5a448bb46cb23d68b8 that didn't involve drawing,
fixing the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=691677

gtk/gtkrange.c

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