From a8674ad37ba14c1e5d1120a0f0561ef37f769911 Mon Sep 17 00:00:00 2001 From: Vladimir Testov Date: Sun, 14 Jul 2013 23:02:37 +0200 Subject: [PATCH] * grub-core/gfxmenu/gui_list.c: Fix height calculation. --- ChangeLog | 4 ++++ grub-core/gfxmenu/gui_list.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c68075c03..8d8596fd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-07-14 Vladimir Testov + + * grub-core/gfxmenu/gui_list.c: Fix height calculation. + 2013-07-14 Vladimir Serbinenko * grub-core/fs/zfs/zfs.c: Stylistic fixes. diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c index 12c352863..d4e9817c5 100644 --- a/grub-core/gfxmenu/gui_list.c +++ b/grub-core/gfxmenu/gui_list.c @@ -102,9 +102,13 @@ get_num_shown_items (list_impl_t self) grub_gfxmenu_box_t box = self->menu_box; int box_top_pad = box->get_top_pad (box); int box_bottom_pad = box->get_bottom_pad (box); + grub_gfxmenu_box_t selbox = self->selected_item_box; + int sel_top_pad = selbox->get_top_pad (selbox); + int sel_bottom_pad = selbox->get_bottom_pad (selbox); return (self->bounds.height + item_vspace - 2 * boxpad - - box_top_pad - box_bottom_pad) / (item_height + item_vspace); + - sel_top_pad - sel_bottom_pad + - box_top_pad - box_bottom_pad) / (item_height + item_vspace); } static int @@ -257,7 +261,7 @@ draw_menu (list_impl_t self, int num_shown_items) int cwidth = oviewport.width - 2 * boxpad - 2; if (selbox->get_border_width) cwidth -= selbox->get_border_width (selbox); - selbox->set_content_size (selbox, cwidth, item_height - 1); + selbox->set_content_size (selbox, cwidth, item_height); selbox->draw (selbox, 0, item_top - sel_toppad); } @@ -397,7 +401,8 @@ list_get_minimal_size (void *vself, unsigned *width, unsigned *height) unsigned width_s; grub_gfxmenu_box_t selbox = self->selected_item_box; - int sel_toppad = selbox->get_top_pad (selbox); + int sel_top_pad = selbox->get_top_pad (selbox); + int sel_bottom_pad = selbox->get_bottom_pad (selbox); *width = grub_font_get_string_width (self->item_font, "Typical OS"); width_s = grub_font_get_string_width (self->selected_item_font, @@ -411,7 +416,8 @@ list_get_minimal_size (void *vself, unsigned *width, unsigned *height) *height = (item_height * num_items + item_vspace * (num_items - 1) + 2 * boxpad - + box_top_pad + box_bottom_pad + sel_toppad); + + box_top_pad + box_bottom_pad + + sel_top_pad + sel_bottom_pad); } else {