This option removes a hardcoded value of three that prevented the
boot_menu from being resized smaller than a certain height.
The new option is called reserve_space_for_n_items and defaults to
three, so themes that relied on the hardcoded value should continue to
work unchanged.
---
docs/grub.texi | 5 +++++
grub-core/gfxmenu/gui_list.c | 14 +++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index 82f6fa4..5143946 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -2285,6 +2285,11 @@ The following is a list of the components and the properties they support.
``menu_w.png``, `menu_nw.png``, etc.)
@item item_pixmap_style
address@hidden The image file pattern for the item styled box.
+ @item reserve_space_for_n_items
+ address@hidden Limit the minimum size of the menu such that at least this
+ many items can be shown. The actual menu height may be taller if
+ the ``height`` property is set. Minimum value is zero. Default
+ is ``3``.
@item selected_item_pixmap_style
address@hidden The image file pattern for the selected item highlight styled box.
@item scrollbar
diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c
index 01477cd..6e32d7e 100644
--- a/grub-core/gfxmenu/gui_list.c
+++ b/grub-core/gfxmenu/gui_list.c
@@ -53,6 +53,8 @@ struct grub_gui_list_impl
int selected_item_color_inherit;
grub_video_rgba_color_t selected_item_color;
+ int reserve_space_for_n_items;
+
int draw_scrollbar;
int need_to_recreate_scrollbar;
char *scrollbar_frame_pattern;
@@ -592,7 +594,7 @@ list_get_minimal_size (void *vself, unsigned *width, unsigned *height)
int boxpad = self->item_padding;
int item_vspace = self->item_spacing;
int item_height = self->item_height;
- int num_items = 3;
+ int num_items = self->reserve_space_for_n_items;
grub_gfxmenu_box_t box = self->menu_box;
int box_left_pad = box->get_left_pad (box);
@@ -737,6 +739,14 @@ list_set_property (void *vself, const char *name, const char *value)
{
self->item_spacing = grub_strtol (value, 0, 10);
}
+ else if (grub_strcmp (name, "reserve_space_for_n_items") == 0)
+ {
+ self->reserve_space_for_n_items = grub_strtol (value, 0, 10);
+ if (self->reserve_space_for_n_items < 0)
+ {
+ self->reserve_space_for_n_items = 0;
+ }
+ }
else if (grub_strcmp (name, "visible") == 0)
{
self->visible = grub_strcmp (value, "false") != 0;
@@ -914,6 +924,8 @@ grub_gui_list_new (void)
self->selected_item_color_inherit = 1; /* Default to using the item_color. */
self->selected_item_color = default_fg_color;
+ self->reserve_space_for_n_items = 3;
+
self->draw_scrollbar = 1;
self->need_to_recreate_scrollbar = 1;
self->scrollbar_frame = 0;
--
2.5.5