diff --git a/ChangeLog b/ChangeLog index 015489a82..733fad1de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-10-17 Vladimir Testov + + * grub-core/gfxmenu/gui_progress_bar.c: Sanity checks added. + 2013-10-17 Vladimir Testov * grub-core/gfxmenu/gui_progress_bar.c: New option ``highlight_overlay`` diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c index 5e0260e01..588f23f10 100644 --- a/grub-core/gfxmenu/gui_progress_bar.c +++ b/grub-core/gfxmenu/gui_progress_bar.c @@ -266,22 +266,40 @@ static void progress_bar_get_minimal_size (void *vself, unsigned *width, unsigned *height) { - unsigned text_width = 0, text_height = 0; + unsigned min_width = 0; + unsigned min_height = 0; grub_gui_progress_bar_t self = vself; if (self->template) { - text_width = grub_font_get_string_width (self->font, self->template); - text_width += grub_font_get_string_width (self->font, "XXXXXXXXXX"); - text_height = grub_font_get_descent (self->font) - + grub_font_get_ascent (self->font); + min_width = grub_font_get_string_width (self->font, self->template); + min_width += grub_font_get_string_width (self->font, "XXXXXXXXXX"); + min_height = grub_font_get_descent (self->font) + + grub_font_get_ascent (self->font); + } + if (check_pixmaps (self)) + { + grub_gfxmenu_box_t bar = self->bar_box; + grub_gfxmenu_box_t hl = self->highlight_box; + min_width += bar->get_left_pad (bar) + bar->get_right_pad (bar); + min_height += bar->get_top_pad (bar) + bar->get_bottom_pad (bar); + if (!self->highlight_overlay) + { + min_width += hl->get_left_pad (hl) + hl->get_right_pad (hl); + min_height += hl->get_top_pad (hl) + hl->get_bottom_pad (hl); + } + } + else + { + min_height += 2; + min_width += 2; } *width = 200; - if (*width < text_width) - *width = text_width; + if (*width < min_width) + *width = min_width; *height = 28; - if (*height < text_height) - *height = text_height; + if (*height < min_height) + *height = min_height; } static void