mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 14:30:15 +00:00
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
This commit is contained in:
parent
d823c39caf
commit
416c370da1
@ -2823,10 +2823,11 @@ _gtk_range_get_wheel_delta (GtkRange *range,
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
GtkAdjustment *adjustment = priv->adjustment;
|
||||
gdouble dx, dy;
|
||||
gdouble delta;
|
||||
gdouble delta = 0;
|
||||
gdouble page_size;
|
||||
gdouble page_increment;
|
||||
gdouble scroll_unit;
|
||||
GdkScrollDirection direction;
|
||||
|
||||
page_size = gtk_adjustment_get_page_size (adjustment);
|
||||
page_increment = gtk_adjustment_get_page_increment (adjustment);
|
||||
@ -2842,16 +2843,15 @@ _gtk_range_get_wheel_delta (GtkRange *range,
|
||||
scroll_unit = 1;
|
||||
#endif
|
||||
|
||||
if (dx != 0 &&
|
||||
gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
|
||||
delta = dx * scroll_unit;
|
||||
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
|
||||
delta = - (dx ? dx : dy) * scroll_unit;
|
||||
else
|
||||
delta = dy * scroll_unit;
|
||||
}
|
||||
else
|
||||
else if (gdk_event_get_scroll_direction ((GdkEvent *) event, &direction))
|
||||
{
|
||||
if (event->direction == GDK_SCROLL_UP ||
|
||||
event->direction == GDK_SCROLL_LEFT)
|
||||
if (direction == GDK_SCROLL_UP ||
|
||||
direction == GDK_SCROLL_RIGHT)
|
||||
delta = - scroll_unit;
|
||||
else
|
||||
delta = scroll_unit;
|
||||
|
Loading…
Reference in New Issue
Block a user