Commit Graph

323 Commits

Author SHA1 Message Date
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
Carlos Garnacho
af5a03c841 range: Make multipress gesture accept all buttons
That gesture is meant to handle clicks from several buttons, so unset
the new GDK_BUTTON_PRIMARY default. Also, remove unnecessary boilerplate
with the new default values.

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:53:40 +02:00
Matthias Clasen
f1d1f139af GtkRange: Set orientable style classes initially
This was an omission, horizontal/vertical would only be set
when the orientation is changed.
2014-07-18 19:39:32 -04:00
Carlos Garnacho
d5b96b95a0 range: Avoid animations during slider drag
If the drag gesture gets a GtkGesture::updated signal, the user
is directly interacting through pointer/touch with the range slider,
animating the adjustment value change in this situation can produce
perceived lag, so set the value immediately when this is happening.
2014-07-08 21:14:41 -04:00
Matthias Clasen
b25b33f79f Drop a leftover declaration
This was left behind when resize grips were removed.
2014-07-06 22:37:57 -04:00
Jasper St. Pierre
ece9ae4bc5 gtkwindow: Remove resize grips
Resize grips were introduced for GNOME 3.0, before we had any of the
"new GNOME app" features like invisible borders and CSD. With OS X 10.6
and 10.7, Apple has replaced the classic grips in their applications
with invisible borders as well.

New GNOME app designs don't use resize grips anymore and the new
default theme for GTK+, Adwaita, disables them entirely by forcing their
width and height to 0.

They're past their time. Remove the code to support them. This can
always be reverted if some app relies on them.
2014-07-03 12:58:41 -04:00
Matthias Clasen
b0a7a6b042 GtkRange: Animate scrollbar jumps 2014-07-02 20:58:16 -04:00
Matthias Clasen
e6f413c6a7 GtkRange: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:07 -04:00
Carlos Garnacho
26dff0d783 range: Use GtkGesture for event management
A multipress gesture takes care of clicks, and where those happened.
If the click is meant to move the slider while pressed, the drag gesture
takes over, dragging the slider while active.
2014-06-05 16:15:54 +02:00