diff options
author | Matthias Clasen <mclasen@redhat.com> | 2012-02-28 23:02:01 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2012-03-01 16:29:01 -0500 |
commit | 6ecc1089f2bd299f6a88507da183a80ea41abd5d (patch) | |
tree | 7c58931d27d92306f9e4669e9f9224b23dbae6af /gtk/gtkrange.c | |
parent | 013da47a07d70ee40eab211850b4238f3fdb4b25 (diff) | |
download | gtk+-6ecc1089f2bd299f6a88507da183a80ea41abd5d.tar.gz |
range: Use the correct size for scaling
When scaling the scroll delta, always use the 'large' dimension
of a range widget. When dx was 0, the code code accidentally
use the small dimension.
Diffstat (limited to 'gtk/gtkrange.c')
-rw-r--r-- | gtk/gtkrange.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index b38fa89da0..a81b26080f 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -2803,6 +2803,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); @@ -2812,22 +2813,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 |