From: Daniel Murcia <[email protected]>
Add support for configuring custom left offset for icons on menu items
---
docs/grub.texi | 2 ++
grub-core/gfxmenu/gui_list.c | 9 +++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index 7181009b6..d5eb4d9c5 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -2436,6 +2436,8 @@ The following is a list of the components and the
properties they support.
@item selected_item_color
@tab The color to use for the selected menu item, or ``inherit`` (the
default)
to use ``item_color`` for the selected menu item as well.
+ @item icon_offset
+ @tab The left offset of menu item icons.
@item icon_width
@tab The width of menu item icons. Icons are scaled to the specified
size.
@item icon_height
diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c
index 2ccd4345f..c1fcf4300 100644
--- a/grub-core/gfxmenu/gui_list.c
+++ b/grub-core/gfxmenu/gui_list.c
@@ -40,6 +40,7 @@ struct grub_gui_list_impl
char *id;
int visible;
+ int icon_offset;
int icon_width;
int icon_height;
int item_height;
@@ -365,7 +366,7 @@ draw_menu (list_impl_t self, int num_shown_items)
selbox->set_content_size (selbox, cwidth - sel_border_width,
text_box_height);
- int text_left_offset = self->icon_width + icon_text_space;
+ int text_left_offset = self->icon_offset + self->icon_width +
icon_text_space;
int item_text_top_offset = (text_box_height - (ascent + descent)) / 2 +
ascent;
int sel_text_top_offset = (text_box_height - (selected_ascent
+ selected_descent)) / 2
@@ -426,7 +427,7 @@ draw_menu (list_impl_t self, int num_shown_items)
icon = get_item_icon (self, menu_index);
if (icon != 0)
grub_video_blit_bitmap (icon, GRUB_VIDEO_BLIT_BLEND,
- max_leftpad,
+ max_leftpad + self->icon_offset,
item_top + icon_top_offset,
0, 0, self->icon_width, self->icon_height);
@@ -707,6 +708,10 @@ list_set_property (void *vself, const char *name, const
char *value)
}
}
}
+ else if (grub_strcmp (name, "icon_offset") == 0)
+ {
+ self->icon_offset = grub_strtol (value, 0, 10);
+ }
else if (grub_strcmp (name, "icon_width") == 0)
{
self->icon_width = grub_strtol (value, 0, 10);
--
2.49.0
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel