Commit 416c370d authored by Matthias Clasen's avatar Matthias Clasen

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
parent d823c39c
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment