]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/gfxmenu/gui_progress_bar.c: Sanity checks added.
authorVladimir Testov <vladimir.testov@rosalab.ru>
Thu, 17 Oct 2013 11:50:25 +0000 (15:50 +0400)
committerVladimir Testov <vladimir.testov@rosalab.ru>
Thu, 17 Oct 2013 11:50:25 +0000 (15:50 +0400)
ChangeLog
grub-core/gfxmenu/gui_progress_bar.c

index 015489a823ad85a31023f68ee5a742780c2333f9..733fad1dee8ac63a72ba0a8471d61351d79351ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-17  Vladimir Testov  <vladimir.testov@rosalab.ru>
+
+       * grub-core/gfxmenu/gui_progress_bar.c: Sanity checks added.
+
 2013-10-17  Vladimir Testov  <vladimir.testov@rosalab.ru>
 
        * grub-core/gfxmenu/gui_progress_bar.c: New option ``highlight_overlay``
index 5e0260e013cf4ce8cb869a5327e1970a5fea83d9..588f23f1022b998666b6f4d81210f7e8c284d9cb 100644 (file)
@@ -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