Commit 9205abe3 authored by Cosimo Cecchi's avatar Cosimo Cecchi

range: allow stepper-spacing > 0 and trough-under-steppers = TRUE

Commit 4bb3d644 introduced a limitation
to GtkRange style properties; when stepper-spacing is > 0,
trough-under-steppers is automatically set to FALSE; this means that
setting a spacing between the steppers (e.g. the scrollbar buttons) and
the trough (i.e. the area over which the slider is free to move) would
make the buttons always get the full allocation on the !orientation
The rationale is without this limitation, you would get an area which
seems clickable, but it's actually not.

While this is true, and undesirable, for big stepper spacings, themes
that use trough-under-steppers (which is TRUE by default anyway),
might want to set smaller spacings to avoid drawing a double line between
the button and the slider borders.

To add confusion, the documentation got it flipped, i.e. it stated
setting a positive stepper-spacing would set trough-under-steppers to
TRUE (which would also make the behavior expected by commit
4bb3d644 impossible).

I don't think hardcoding either of the two limitations is a good thing.
We should let themes handle this instead, and remove this limitation. If
you want the old behavior, you can manually set trough-under-steppers to
FALSE if you set a positive stepper-spacing in your theme.
parent 66a77d0b
......@@ -542,8 +542,6 @@ gtk_range_class_init (GtkRangeClass *class)
* GtkRange:stepper-spacing:
* The spacing between the stepper buttons and thumb. Note that
* setting this value to anything > 0 will automatically set the
* trough-under-steppers style property to %TRUE as well. Also,
* stepper-spacing won't have any effect if there are no steppers.
gtk_widget_class_install_style_property (widget_class,
......@@ -575,9 +573,7 @@ gtk_range_class_init (GtkRangeClass *class)
* GtkRange:trough-under-steppers:
* Whether to draw the trough across the full length of the range or
* to exclude the steppers and their spacing. Note that setting the
* #GtkRange:stepper-spacing style property to any value > 0 will
* automatically enable trough-under-steppers too.
* to exclude the steppers and their spacing.
* Since: 2.10
......@@ -2043,9 +2039,6 @@ gtk_range_draw (GtkWidget *widget,
if (!sensitive)
gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
if (stepper_spacing > 0)
trough_under_steppers = FALSE;
if (!trough_under_steppers)
gint offset = 0;
......@@ -3216,9 +3209,6 @@ gtk_range_get_props (GtkRange *range,
"arrow-displacement-y", &tmp_arrow_displacement_y,
if (tmp_stepper_spacing > 0)
tmp_trough_under_steppers = FALSE;
if (gtk_widget_get_can_focus (GTK_WIDGET (range)))
gint focus_line_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