[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fix menu size calculation in presence of selected item pixmap
From: |
Andrey Borzenkov |
Subject: |
[PATCH] fix menu size calculation in presence of selected item pixmap |
Date: |
Thu, 21 Feb 2013 21:36:41 +0400 |
draw_menu() acconted for upper border of selected item pixmap, but not
for lower. So it could happen that lower border was visually cut off.
Also various calculations of menu vertical size did not account for
space for lower border
Signed-off-by: Andrey Borzenkov <address@hidden>
---
grub-core/gfxmenu/gui_list.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c
index 1982d9a..5c83383 100644
--- a/grub-core/gfxmenu/gui_list.c
+++ b/grub-core/gfxmenu/gui_list.c
@@ -97,8 +97,14 @@ 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
+ - sel_top_pad - sel_bottom_pad
- box_top_pad - box_bottom_pad) / (item_height + item_vspace);
}
@@ -392,7 +398,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,
@@ -406,7 +413,7 @@ 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
{
--
tg: (cc35b49..) e/menu-selected-pad (depends on: master)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] fix menu size calculation in presence of selected item pixmap,
Andrey Borzenkov <=