summaryrefslogtreecommitdiff
path: root/gtk/gtkrange.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-07-12 18:10:06 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-07-12 18:10:06 +0000
commit82ffb2f502e026f22c7cdbc47478646dab6c9a58 (patch)
treef8f8a0bc49fdbb83d42a8ba2a256fe822a101a35 /gtk/gtkrange.c
parent3c57c9614836cbab2c76b0f921a971f615638032 (diff)
downloadgtk+-82ffb2f502e026f22c7cdbc47478646dab6c9a58.tar.gz
Add missing case.
Thu Jul 12 14:06:19 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkmenubar.c (gtk_menu_bar_hierarchy_changed): Add missing case. * gtk/gtkcontainer.c (gtk_container_get_focus_chain): Fix NULL/FALSE return value confusion. * gtk/gtkrange.c (coord_to_value): Fix division-by-zero problem when scrollbar completely fills range. (Patch from Matthias Clasen, #57047)
Diffstat (limited to 'gtk/gtkrange.c')
-rw-r--r--gtk/gtkrange.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 2883cbc3a2..cf8d427114 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1021,11 +1021,17 @@ coord_to_value (GtkRange *range,
gdouble value;
if (range->orientation == GTK_ORIENTATION_VERTICAL)
- frac = ((coord - range->layout->trough.y) /
- (gdouble) (range->layout->trough.height - range->layout->slider.height));
+ if (range->layout->trough.height == range->layout->slider.height)
+ frac = 1.0;
+ else
+ frac = ((coord - range->layout->trough.y) /
+ (gdouble) (range->layout->trough.height - range->layout->slider.height));
else
- frac = ((coord - range->layout->trough.x) /
- (gdouble) (range->layout->trough.width - range->layout->slider.width));
+ if (range->layout->trough.width == range->layout->slider.width)
+ frac = 1.0;
+ else
+ frac = ((coord - range->layout->trough.x) /
+ (gdouble) (range->layout->trough.width - range->layout->slider.width));
if (should_invert (range))
frac = 1.0 - frac;