summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/gtkrange.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 87a7f620b3..cdfd939622 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2805,6 +2805,7 @@ _gtk_range_get_wheel_delta (GtkRange *range,
gdouble dx, dy;
gdouble delta;
gdouble page_size;
+ gdouble size;
page_size = gtk_adjustment_get_page_size (adjustment);
@@ -2814,22 +2815,27 @@ _gtk_range_get_wheel_delta (GtkRange *range,
gtk_widget_get_allocation (GTK_WIDGET (range), &allocation);
+ if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
+ size = allocation.width;
+ else
+ size = allocation.height;
+
if (dx != 0 &&
gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
{
if (GTK_IS_SCROLLBAR (range) && page_size > 0)
- delta = dx * page_size / allocation.width;
+ delta = dx * page_size / size;
else
delta = dx * (gtk_adjustment_get_upper (adjustment) -
- gtk_adjustment_get_lower (adjustment)) / allocation.width;
+ gtk_adjustment_get_lower (adjustment)) / size;
}
else
{
if (GTK_IS_SCROLLBAR (range) && page_size > 0)
- delta = dy * page_size / allocation.height;
+ delta = dy * page_size / size;
else
delta = dy * (gtk_adjustment_get_upper (adjustment) -
- gtk_adjustment_get_lower (adjustment)) / allocation.height;
+ gtk_adjustment_get_lower (adjustment)) / size;
}
}
else