Commit Graph

384 Commits

Author SHA1 Message Date
Cosimo Cecchi
7ff2f451ce range: add positional style classes to fill/highlight
Requested by Lapo.
2016-03-04 11:57:31 -08:00
Cosimo Cecchi
8ebc03a1d1 range: use border allocation for gadget hit test
The border is typically part of the reactive part of the widget. This
matches the pre-gadget behavior.
2016-03-02 22:23:11 -08:00
Matthias Clasen
cb614cc838 range: Don't leave css nodes behind
We create and destroy gadgets inside the range hierarchy here,
and if we don't explicitly remove their CSS nodes from the parent,
they stick around.
2016-03-01 15:48:01 -05:00
Cosimo Cecchi
d000b212c6 range: fix fill level for vertical inverted scales 2016-02-29 12:53:08 -08:00
Cosimo Cecchi
0c8dbf07ce range: draw slider on top of all contents
This is so that e.g. the focus ring is drawn under the slider.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
bc41ff8af4 range: better hack for GtkColorScale
Just draw the slider, since that is the only thing GtkColorScale cares
about.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
887b6d65a1 range: deprecate gtk_range_get/set_min_slider_size()
Nothing uses these functions inside GTK anymore.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
424f17c0fb range: don't use gtk_range_set_min_slider_size()
The way this method is used from the GtkRange subclasses doesn't really
work well when the slider properties change as a consequence of e.g. a
style class being applied (e.g. the fine-tune style class).

In fact, there's no need to read the minimum slider size out of band,
and we can obtain the same result in a way that always work by setting a
private property on GtkRange.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
0883ff5eed range: use border box for slider area
Since we can use negative margins, we should not use the margin box
for the slider area. Use the border box instead, since that's what is
typically mapped to the visible area.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
6ecab5ee6b range: use new GtkCssGadget API instead of rolling our own 2016-02-29 10:45:13 -08:00
Cosimo Cecchi
2d2a81682d range: simplify code
Instead of directly accessing the widget allocation, we can use the
gadget API to test whether the coordinates are in the main gadget.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
d1433c25f3 range: add a gadget for the whole widget area
This commit introduces another node, called "contents", that holds the
main contents of the range. This allows for the main gadget itself to
span across the whole surface of the widget now.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
a9ea544f3d scale: always add marks at the beginning or the end
Marks are always either the first or the last child of the scale.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
1d047f0097 range: use new GtkBoxGadget API instead of counting children 2016-02-29 10:45:13 -08:00
Cosimo Cecchi
6401e2405e range: use new GtkBoxGadget API instead of removing/inserting 2016-02-29 10:45:13 -08:00
Cosimo Cecchi
6827bd5e04 range: move slider drawing where it belongs
The slider gadget is a child of the trough gadget, so draw it from
there.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
0974b0d843 range: whitespace fix 2016-02-29 10:45:12 -08:00
Cosimo Cecchi
fb11cc1baf range: remove border allocation hack
We can achieve the same result with a negative margin.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
8b87eca11e Revert "range: move GtkColorScale special case to GtkColorScale"
This reverts commit d93d266ed9e3e26e382a4f6d4b5d4ea19eff3bcf.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
b927fc0874 Revert "range: simplify code"
This reverts commit a74f7dcaf8a02c96c6bfecab6969e1d33ecb9332.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
a7099d1468 range: simplify code
Now that everything is in the main gadget, we can just let it propagate
drawing to its children.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
b6f0b6be87 range: move GtkColorScale special case to GtkColorScale
Now we can just tweak the node visibility for it.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
cbbe237c18 range: remove special case that's not needed
We already set the gadget not to be visible in that case.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
ddb863e523 range: move slider inside the trough
This will require a rewrite of most of the theme, but it's the right
thing to do.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
d1c5ecfaef scale: deprecate slider-length style property
This can be achieved using min-height/min-width CSS properties now.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
c1eff2cce5 range: deprecate more style properties
These are never read now.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
413b9d5b3c range: continue porting to GtkGadgets
This commit rewrites a lot of the GtkRange internals to make full use
of the gadget structure.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
8c43b3ee60 range: remove unused code 2016-02-29 10:45:12 -08:00
Cosimo Cecchi
6c19947859 range: remove call that is not needed
gtk_range_calc_slider() already calls the same function when needed.
2016-02-29 10:45:12 -08:00
Cosimo Cecchi
83a6471c4e range: simplify code a bit 2016-02-29 10:45:11 -08:00
Cosimo Cecchi
d19215015e range: don't call gtk_range_calc_layout() in realize()
This should not be needed, and we want to get rid of
gtk_range_calc_layout().
2016-02-29 10:45:11 -08:00
Cosimo Cecchi
1f9de3cfec range: deprecate arrow-scaling style property
This can be done with CSS now.
2016-02-29 10:45:11 -08:00
Cosimo Cecchi
3b37f2a42a range: use newer GtkCssGadget API 2016-02-29 10:45:11 -08:00
Cosimo Cecchi
d0c671ddfe range: deprecate trough-under-steppers
It's not clear what this would do in a CSS world, and all the themes set
it to TRUE anyway...
2016-02-29 10:45:11 -08:00
Cosimo Cecchi
4bb0a8db47 range: first pass at porting to gadgets
There's still a lot to be done, but this is functional and we'll improve
the loose ends in the next commits.
2016-02-29 10:45:11 -08:00
Timm Bäder
35cd0be468 Range: Group all three gestures
And reset the grab_location in the ::released handler of the multipress
gesture.

Previously, when leaving fine-tune mode, the ::released handler of the
multipress gesture would call stop_scrolling, which calls
range_grab_remove and resets the grab_location. The ::drag-end handler
is executed after that, and only unsets priv->in_drag if the
grab_location is MOUSE_OUTSIDE, which it never was, since the ::released
handler already reset it. This lead to priv->in_drag being set even
though no dragging was in progress anymore, which e.g. made shift
pressed after leaving the fine-tune mode entering it again.

https://bugzilla.gnome.org/show_bug.cgi?id=761402
2016-02-04 17:08:30 +01:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Timm Bäder
2b9d57f726 GtkRange: Return proper constants in signal handlers 2015-12-02 21:06:11 +01:00
Timm Bäder
5a6bac7831 GtkRange: Remove recalc_marks field
And instead recalculate the marks on demand, i.e. whenever we were
previously setting recalc_marks to TRUE.
2015-12-02 21:06:11 +01:00
Timm Bäder
414ffbb708 GtkRange: Use G_MININT as default mouse position, not -1
Otherwise we're getting MOUSE_WIDGET as mouse position for unmapped
GtkRanges.
2015-12-02 21:06:11 +01:00
Benjamin Otte
3513e5e87b Chain up in state_flags_changed
When introducing handlers for state_flags_changed in the node
transitions, chaining up was forgotten.
2015-12-02 04:36:31 +01:00
Matthias Clasen
43f822e70f Annotate deprecated style properties
Use G_PARAM_DEPRECATED with deprecated style properties.
This will make it easier to identify and remove such stale
properties from css, since it will now trigger warnings.
2015-11-16 15:13:33 -05:00
Matthias Clasen
90f8b054b3 range: Document some style properties as deprecated
Remove dead code dealing with the arrow-displacement-x/y style
properties, and document them as deprecated.
2015-11-16 07:20:18 -05:00
Matthias Clasen
6c5d08d75a Cosmetic: Avoid explicit state variables
Fold it into its single user.
2015-11-14 12:32:57 -05:00
Matthias Clasen
d25e0657be range: Fixes to the new trough rendering
There was an errant y that caused some troughs to not be drawn.
And also set the state of the fill node.
2015-11-06 22:27:31 -05:00
Matthias Clasen
11d7f6df7c range: Use CSS nodes for all trough rendering
This replaces the somewhat freewheeling use of style classes to
render a part of the trough highlighted and show a fill level.
2015-11-06 19:25:58 -05:00
Benjamin Otte
68ed166c60 range: Use right state when querying margin 2015-11-06 18:59:15 +01:00
Matthias Clasen
38cd2c1239 range: Update trough state
It might make sense for the theme to render an insensitive trough
differently.
2015-11-06 11:53:42 -05:00
Matthias Clasen
4ed47e757f Fix a crash with steppers
The introduction of the trough node was not properly carried
into the code constructing stepper nodes, and was causing
assertion failures there. This was only showing up on Windows,
since Adwaita and HighContrast don't have steppers.
2015-11-05 09:44:14 -05:00
Matthias Clasen
2e314940af range: Redraw when slider visiblity changes
We were not queuing a draw (and not updating the CSS node) when
the slider visibility changed. This was exposed by the Trough
button in tests/testscale.
Fix this by taking slider visibility into account when deciding
whether to queue a draw in response to adjustment changes.
2015-11-05 07:26:10 -05:00