[gtk+/gtk-3-16] GtkRange: Fix scroll wheel direction for horizontal ranges
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-16] GtkRange: Fix scroll wheel direction for horizontal ranges
- Date: Mon, 23 Mar 2015 03:12:51 +0000 (UTC)
commit beb19b389bb959af2ff3448e70ed354a71245eb4
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Mar 17 22:02:35 2015 -0400
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
gtk/gtkrange.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 4e40b21..40b8f56 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]