]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Take into account the decorations the computing menu entry width.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 18 Apr 2011 22:44:53 +0000 (00:44 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 18 Apr 2011 22:44:53 +0000 (00:44 +0200)
* grub-core/gfxmenu/widget-box.c (get_border_width): New function.
(grub_gfxmenu_create_box): Register get_border_width.
* grub-core/gfxmenu/gui_list.c (draw_menu): Use get_border_width
if available.
* include/grub/gfxwidgets.h (grub_gfxmenu_box): New member
get_border_width.

ChangeLog
grub-core/gfxmenu/gui_list.c
grub-core/gfxmenu/widget-box.c
include/grub/gfxwidgets.h

index 8c00f7849086ac1200de7a4fef2831947a6dd8df..79d868f867b6412e2884f4c82445966300ce829e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-04-19  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Take into account the decorations the computing menu entry width.
+
+       * grub-core/gfxmenu/widget-box.c (get_border_width): New function.
+       (grub_gfxmenu_create_box): Register get_border_width.
+       * grub-core/gfxmenu/gui_list.c (draw_menu): Use get_border_width
+       if available.
+       * include/grub/gfxwidgets.h (grub_gfxmenu_box): New member
+       get_border_width.
+
 2011-04-18  Endres Puschner <code@e7p.de>
 
        * grub-core/gfxmenu/icon_manager.c (grub_gfxmenu_icon_manager_get_icon):
index b6b07dfd6221b02ed949da1790c2652eb5146d3d..e5d6fc2a103809ed02bf60119ddc088ba7dc27e3 100644 (file)
@@ -248,8 +248,10 @@ draw_menu (list_impl_t self, int num_shown_items)
 
       if (is_selected)
         {
-          selbox->set_content_size (selbox, oviewport.width - 2 * boxpad - 2,
-                                   item_height - 1);
+         int cwidth = oviewport.width - 2 * boxpad - 2;
+         if (selbox->get_border_width)
+           cwidth -= selbox->get_border_width (selbox);
+         selbox->set_content_size (selbox, cwidth, item_height - 1);
           selbox->draw (selbox, 0,
                         item_top - sel_toppad);
         }
index 244fe1e6c4f283702a9a98f790d31a221c275057..41ca7f53645011911f544e823788e482b7e9a068 100644 (file)
@@ -178,6 +178,13 @@ set_content_size (grub_gfxmenu_box_t self,
     return;
 }
 
+static int
+get_border_width (grub_gfxmenu_box_t self)
+{
+  return (get_width (self->raw_pixmaps[BOX_PIXMAP_E])
+         + get_width (self->raw_pixmaps[BOX_PIXMAP_W]));
+}
+
 static int
 get_left_pad (grub_gfxmenu_box_t self)
 {
@@ -288,6 +295,8 @@ grub_gfxmenu_create_box (const char *pixmaps_prefix,
 
   box->draw = draw;
   box->set_content_size = set_content_size;
+  box->get_border_width = get_border_width;
+
   box->get_left_pad = get_left_pad;
   box->get_top_pad = get_top_pad;
   box->get_right_pad = get_right_pad;
index f9678bf9e9c40e72677e962cf40821faf5fa1294..8ce666c5c0bd8e0b65143933ab300bebcef24329 100644 (file)
@@ -36,6 +36,7 @@ struct grub_gfxmenu_box
   void (*draw) (grub_gfxmenu_box_t self, int x, int y);
   void (*set_content_size) (grub_gfxmenu_box_t self,
                             int width, int height);
+  int (*get_border_width) (grub_gfxmenu_box_t self);
   int (*get_left_pad) (grub_gfxmenu_box_t self);
   int (*get_top_pad) (grub_gfxmenu_box_t self);
   int (*get_right_pad) (grub_gfxmenu_box_t self);