Commit Graph

331 Commits

Author SHA1 Message Date
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
Benjamin Otte
e7f2239cbb range: Remove unused variable 2014-11-25 19:19:11 +01:00
Lapo Calamandrei
5108a27e6c gtkrange: consider css margin on the slider
Css margin now works on the slider as they do on the trough.
The margin is not considered in the space allocation as it is for
the trough, so the slider width will be the set slider-width -
margins. Spefifying margins on the main widget in the css will
clearly affect both the trough and the slider, so theme changes are
needed.
2014-11-12 17:20:53 +01:00
Matthias Clasen
7dd466ad74 Set the clip on range widgets
This will allow better scrollbar theming.
2014-11-08 12:55:37 -05:00
Matthias Clasen
1fad6b049b GtkRange: Add a style class during dragging
This will be used to identify a scrollbar is being dragged - we
don't actually need the style class; another way to keep track
of the dragging status would be ok too.
2014-10-20 23:07:45 -04:00
Matthias Clasen
cfd2d6d2e7 Typo fix 2014-09-26 22:30:20 -04:00
Matthias Clasen
e586dd2571 GtkRange: Fix an event propagation issue
The scale in the selectable listbox in page 2 of gtk3-widget-factory
has the flaw that the row is getting selected even when one only
interacts with the scale - unlike e.g. the checkbutton and button
further down in the listbox.

The problem is that GtkRange is trying to claim the sequence for
the drag gesture from the ::pressed handler of a multipress
gesture. Since the drag gesture hasn't seen the sequence at this
point, that is ineffective.

The fix here is to rearrange the gestures so that the multipress
gesture sees the sequence before the drag gesture, and then
claim the sequence from the ::drag-begin handler.
2014-09-26 22:21:11 -04:00
Matthias Clasen
b333d5ea4e GtkRange: claim sequence when popping up menu
This was clearly an oversight - the function claims the sequence
at the end, and for the popup menu case, we have an early exit
that misses this.
2014-09-26 19:18:57 -04:00
Jesse van den Kieboom
3fa425bb9c scrolling: interpret smooth deltas as pixels on quartz
This is a temporary workaround for scrolling units being amplified
on quartz, due to the assumption that smooth scrolling deltas are
always in some abstract unit similar to the one from xi2.

A proper solution for the situation is described in bug #736121, but
since we are close to release, this patch solves the issue temporarily.

https://bugzilla.gnome.org/show_bug.cgi?id=736121
2014-09-05 14:02:11 +02:00
Benjamin Otte
6c06bd55da gtk: Don't use gtk_render_activity()
... in places where we draw a background. This was changed for GTK 3.0.0
to allow animations, but these days it doesn't make sense anymore to use
gtk_render_activity() for backgrounds.
2014-08-16 16:34:14 +02:00