Commit Graph

340 Commits

Author SHA1 Message Date
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
Matthias Clasen
973836d395 range: Add private api to get the trough node
This will be needed in range subclasses to position their
own subnodes.
2015-11-05 07:26:10 -05:00
Matthias Clasen
2bfb5ad812 range: Add a CSS node for the trough
This is in sync with what we do elsewhere for troughs.
2015-11-05 07:26:10 -05:00
Matthias Clasen
8727c8fe24 range: Convert to CSS nodes
Use CSS nodes for GtkScale and GtkScrollbar. See their documentation
for details on what subnodes with what names exist.
2015-11-03 23:17:09 -05:00
Benjamin Otte
2dad7c1319 gdk: Add gdk_rectangle_equal()
There's enough users inside GTK to warrant this convenience function.
2015-10-03 22:26:27 -04:00
Matthias Clasen
c3038c2fe1 range: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:36 -04:00
Matthias Clasen
0f479deb5e range: Tweak button bindings
Change things around so that warp-to-click and jump-by-pages are
bound to left-click and shift-left-click, depending on the value
of gtk-primary-button-warps-slider. Autoscrolling is bound to
right-click.

To achieve this, reorganize gtk_range_multipress_gesture_pressed
so that the functions are clearly separated.
2015-07-13 22:40:43 -04:00
Matthias Clasen
1ca6d8b1b5 range: Trivial field ordering 2015-07-12 01:53:36 -04:00
Matthias Clasen
1c780beb8b range: Add a stepper alternative
Make shift right-click on the trough start autoscrolling. The
autoscrolling is similar to the way steppers operate now, with
the difference that we vary the scrolling speed based on the
distance of the pointer from the widget.
2015-07-12 01:42:03 -04:00
Matthias Clasen
6e280d2478 range: switch secondary and middle button on steppers
Clicking on steppers does different things depending on which
button you use. We used to scroll to the end on secondary click
and use high-speed autoscrolling on middle-click. Switch these
two around, since the scroll-to-end functionality is less likely
to be useful, and the seconary button makes the autoscrolling
more easily available.
2015-07-12 00:23:32 -04:00
Matthias Clasen
93f9a81ac5 GtkRange: Improve zoom handling a bit
The calculation to update the initial slider position on zoom
changes was not working correctly when using keys to toggle
zoom on and off for scales. Avoid it by updating the position
beforehand.
2015-06-20 20:26:42 -04:00
Matthias Clasen
27dabaefa6 GtkRange: Make drag gesture less agressive
Moving the mouse while pressing one of the steppers was making
the slider jump to the end, unexpectedly. This was caused by the
drag gesture kicking in when it shouldn't. Fix this by making
all drag gesture signal handlers only do something if we are in
a drag thats started on the slider.

https://bugzilla.gnome.org/show_bug.cgi?id=751050
2015-06-20 18:37:15 -04:00
Lars Uebernickel
422d8728fa GtkRange: fix horizontal scrolling
https://bugzilla.gnome.org/show_bug.cgi?id=737175
2015-04-17 11:00:25 -04:00
Marcus Karlsson
38f61dd445 GtkRange: Check "inverted" property when drawing
The direction in which the slider moves can be inverted by setting the
inverted property. But the draw method does not check this, instead it
checks if the direction of the widget is set to be right to left.

Call the should_invert function in order to determine if the direction
of the range should be inverted. It too checks the widget's direction,
but also checks the "inverted" property, and allows the range to be
drawn inverted even if it is vertically oriented.

https://bugzilla.gnome.org/show_bug.cgi?id=746712
2015-03-24 23:19:50 -04:00
Marcus Karlsson
abf3d78b57 GtkRange: Fix drawing of fill-level
Compute the proportion of the range that should be filled to match the
fill level, and use it to compute the starting point and length of the
area between the slider and the fill level.

https://bugzilla.gnome.org/show_bug.cgi?id=734741
2015-03-24 22:45:14 -04:00
Matthias Clasen
eea16f03f5 Stop using GDK_POINTER_MOTION_HINT_MASK in widgets
It is deprecated and no longer needed, and,as observed in
https://bugzilla.gnome.org/show_bug.cgi?id=746253 it
interferes with turning off event compression.
2015-03-22 17:33:38 -04:00
Matthias Clasen
416c370da1 GtkRange: Fix scroll wheel direction for horizontal ranges
The expected behavior here is that scrolling up goes towards
larger values, ie to the right. This matches e.g. volume
sliders in gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=737175
2015-03-17 22:02:35 -04:00
Matthias Clasen
c73ab94d3f range: Make steppers use smooth autoscrolling
This makes them work much nicer than the old timer-based
implementation.
2015-02-23 08:38:38 -05:00
Matthias Clasen
3222de2f91 range: Make zoom scrolling less sensitive
Use the new long press delay factor to make the zoom
scrolling less easy to trigger accidentally.
2015-02-23 08:38:25 -05:00
Matthias Clasen
c060d93e3d zoom scrolling: Improve the previous fix
As Sebastian pointed out, just resetting the initial slider
position was an incomplete fix, because it does not cause the
delta to be recomputed, which is important in this scenario,
because you've likely travelled some distance over the slider
before the long press kicks in.
Instead, explicitly record both the slider position and the
delta.
2015-02-23 07:28:40 -05:00
Matthias Clasen
8726c6d5d2 zoom scrolling: avoid 'jumping back'
We record the starting position on button press, but only
start the zoom mode when the long press timeout kicks in.
Depending on circumstances, this can cause a noticable jump.

Avoid this by resetting the recorded starting position after
the long press timeout. Suggested by Sebastian Keller.
2015-02-23 06:46:21 -05:00
Benjamin Otte
4c33645a7a range: Implement :hover for the whole widget 2014-11-29 03:42:29 +01:00
Benjamin Otte
116cc53105 range: Handle redraws inside update_mouse_location
This way, we can do finer-grained invalidation. Plus, we get to not
duplicate all the queue_draw() calls.
2014-11-29 03:42:29 +01:00
Benjamin Otte
95dc96901e range: Properly queue draws when doing a drag
The dragged area needs to be marked as :active during the drag.
2014-11-29 03:42:29 +01:00
Benjamin Otte
b8c0cfb663 range: Remove unused variable
The variable was TRUE from the beginning and only ever set to TRUE.
2014-11-29 03:42:28 +01:00
Benjamin Otte
4b92654b29 range: No need to update mouse location when starting a drag
The mouse position doesn't change here. Plus, all callers have just
updated it anyway.
2014-11-29 03:42:28 +01:00
Benjamin Otte
87c564ecf3 range: Only call needed functions from adjustment changes
No need to recalc the whole range when all that changed was the slider.
2014-11-29 03:42:28 +01:00
Benjamin Otte
f3b40ff55f range: Implement gtk_range_calc_stepper_sensitivity() properly 2014-11-29 03:42:28 +01:00
Benjamin Otte
f63fe9b760 range: Implement gtk_range_calc_slider() properly 2014-11-29 03:42:28 +01:00
Benjamin Otte
040c31a32c range: Refactor a function
This is in preparation for more places that want to
queue_draw_location().
2014-11-29 03:42:28 +01:00
Benjamin Otte
909d0caa6b range: Introduce finer-grained invalidation
The invalidation doesn't do anything yet, it just clears up what
actually needs recalculation.
2014-11-29 03:42:28 +01:00
Benjamin Otte
1c9fdc1f1f range: Changing the min slider size requires a resize 2014-11-29 03:42:28 +01:00
Benjamin Otte
c80c7f7792 range: No need to frce a recalc
A resize will already trigger a recalc, so no need to explicitly trigger
it.
2014-11-29 03:42:28 +01:00
Benjamin Otte
11233678d9 range: Remove unnecessary argument
It's always the same value passed in, so just use that value directly.
2014-11-26 13:53:57 +01:00
Benjamin Otte
230aa99967 range: Query slider position instead of updating it
We're updating it later in the function, there's no need to do it here.
2014-11-26 13:53:57 +01:00
Benjamin Otte
7193043f7d gtkrange: Fix copy/paste error
When factoring out a function in
b88584e7ba I forgot to adapt these values.
2014-11-26 13:53:57 +01:00
Benjamin Otte
98da1ddfe2 range: Setting stepper visibility requires a restyle 2014-11-26 13:53:57 +01:00
Benjamin Otte
c0123ae20e range: Don't duplicate work
The adjustment value being equal is checked by
gtk_adjustment_set_value() and the necessity of calc_layout() is handled
by the value_changed signal handler.
2014-11-25 19:19:12 +01:00
Benjamin Otte
06150aa517 range: Don't invalidate layout when computing marks
We now have a function to compute a slider position. Use that one
instead.
2014-11-25 19:19:12 +01:00
Benjamin Otte
b88584e7ba range: Split out a function
The position of a slider for a given value is something we care a
lot about and jump through hoops to get. See next commit for example.
2014-11-25 19:19:12 +01:00
Benjamin Otte
daabd0436f range: Remove 2 variables
Instead, compute their value on-demand.
2014-11-25 19:19:12 +01:00
Benjamin Otte
447a439145 range: Remove unused variable 2014-11-25 19:19:12 +01:00
Benjamin Otte
addcb7137e range: Simplify defines
- Delete unused defines
- Don't have 2 defines that are multiplied later
2014-11-25 19:19:12 +01:00
Benjamin Otte
51f5433170 range: Deprecate detail strings in class struct
... and stop setting them.
2014-11-25 19:19:12 +01:00
Benjamin Otte
0d1395d07f range: Remove unused detail quarks 2014-11-25 19:19:11 +01:00