]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/gfxmenu/gui_list.c (draw_scrollbar): Fixed rare
authorVladimir Testov <vladimir.testov@rosalab.ru>
Tue, 8 Oct 2013 14:49:35 +0000 (18:49 +0400)
committerVladimir Testov <vladimir.testov@rosalab.ru>
Tue, 8 Oct 2013 14:49:35 +0000 (18:49 +0400)
       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.

ChangeLog
grub-core/gfxmenu/gui_list.c

index dc453dcbbf06acb66e85e27d43a234c01cead9c6..f5829f45f42d957678fb9ae59b1730964743043e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-08  Vladimir Testov  <vladimir.testov@rosalab.ru>
+
+       * 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  <phcoder@gmail.com>
 
        * util/random_unix.c: Add NetBSD and Mac OS X to verified list.
index 2cc3a5303c3684ff53d728628ec65fa347e7cee8..c9e7bf35b5a7d097fe1ad235dee6e75d77c74c36 100644 (file)
@@ -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,