summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-03-18 02:02:35 (GMT)
committerMatthias Clasen <mclasen@redhat.com>2015-03-29 21:22:36 (GMT)
commitf34ecab28f94bd36dc8201b4f81c6b290806195e (patch)
tree660851d4c1394ba9262dcc69b994a2ef25659c0d
parentb76e9e35e6fa82d970ab234c8989f524f16a2826 (diff)
downloadgtk+-f34ecab28f94bd36dc8201b4f81c6b290806195e.zip
gtk+-f34ecab28f94bd36dc8201b4f81c6b290806195e.tar.xz
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
-rw-r--r--gtk/gtkrange.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 4c36b75..036802e 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2819,10 +2819,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);
@@ -2838,16 +2839,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;