From: Vladimir Testov Date: Tue, 8 Oct 2013 14:49:35 +0000 (+0400) Subject: * grub-core/gfxmenu/gui_list.c (draw_scrollbar): Fixed rare X-Git-Tag: grub-2.02-beta1~762 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53a5f5c2f05d774d2a93eaeb020d2c69d493fd59;p=thirdparty%2Fgrub.git * grub-core/gfxmenu/gui_list.c (draw_scrollbar): Fixed rare occasional bug. If there are too many boot entries or too low scrollbar height then we need to use another formula to calculate the position and size of the scrollbar thumb. --- diff --git a/ChangeLog b/ChangeLog index dc453dcbb..f5829f45f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-10-08 Vladimir Testov + + * grub-core/gfxmenu/gui_list.c (draw_scrollbar): Fixed rare + occasional bug. If there are too many boot entries or too low + scrollbar height then we need to use another formula to calculate + the position and size of the scrollbar thumb. + 2013-10-08 Vladimir Serbinenko * util/random_unix.c: Add NetBSD and Mac OS X to verified list. diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c index 2cc3a5303..c9e7bf35b 100644 --- a/grub-core/gfxmenu/gui_list.c +++ b/grub-core/gfxmenu/gui_list.c @@ -219,6 +219,13 @@ draw_scrollbar (list_impl_t self, tracklen); int thumby = tracktop + tracklen * (value - min) / (max - min); int thumbheight = tracklen * extent / (max - min) + 1; + /* Rare occasion: too many entries or too low height. */ + if (thumbheight < thumb_vertical_pad) + { + thumbheight = thumb_vertical_pad; + thumby = tracktop + ((tracklen - thumb_vertical_pad) * (value - min) + / (max - extent)); + } thumb->set_content_size (thumb, scrollbar_width - frame_horizontal_pad - thumb_horizontal_pad,