New options to manage scrollbar's padding.

Ask if it should be commented and supported with screenshots.

-- 
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
diff -Naur grub-new7/grub-core/gfxmenu/gui_list.c grub-new8/grub-core/gfxmenu/gui_list.c
--- grub-new7/grub-core/gfxmenu/gui_list.c	2013-03-28 14:56:58.157916412 +0400
+++ grub-new8/grub-core/gfxmenu/gui_list.c	2013-04-03 17:46:21.953921226 +0400
@@ -54,6 +54,10 @@
   grub_gfxmenu_box_t scrollbar_frame;
   grub_gfxmenu_box_t scrollbar_thumb;
   int scrollbar_width;
+  int scrollbar_left_pad;
+  int scrollbar_right_pad;
+  int scrollbar_top_pad;
+  int scrollbar_bottom_pad;
 
   int first_shown_index;
 
@@ -254,7 +258,11 @@
 			   oviewport.width - 2 * boxpad,
 			   oviewport.height - 2 * boxpad);
 
-  int cwidth = oviewport.width - 2 * boxpad - 2;
+  int cwidth;
+  if (self->list_version == 0)
+    cwidth = oviewport.width - 2 * boxpad - 2;
+  else
+    cwidth = oviewport.width - 2 * boxpad - self->scrollbar_left_pad;
   if (selbox->get_border_width)
     cwidth -= selbox->get_border_width (selbox);
   if (self->list_version == 0)
@@ -381,6 +389,8 @@
     int drawing_scrollbar = (self->draw_scrollbar
 			     && (num_shown_items < self->view->menu->size)
 			     && check_scrollbar (self));
+    if (!drawing_scrollbar)
+      self->scrollbar_left_pad = 0;
 
     content_rect.x = box_left_pad;
     content_rect.y = box_top_pad;
@@ -396,7 +406,7 @@
         grub_gfxmenu_box_t frame = self->scrollbar_frame;
         int frame_horizontal_pad = frame->get_left_pad (frame)
                                    + frame->get_right_pad (frame);
-        content_rect.width -= frame_horizontal_pad + self->scrollbar_width;
+        content_rect.width -= frame_horizontal_pad + self->scrollbar_width - self->scrollbar_right_pad;
       }
 
     grub_gui_set_viewport (&content_rect, &vpsave2);
@@ -406,13 +416,22 @@
     int rightx = self->bounds.width - box_right_pad;
     if (self->list_version == 0)
       rightx += self->scrollbar_width;
+    else
+      rightx -= self->scrollbar_right_pad;
+    int topy = box_top_pad;
+    int height = self->bounds.height - box_top_pad - box_bottom_pad;
+    if (self->list_version > 0)
+      {
+        topy += self->scrollbar_top_pad;
+        height -= self->scrollbar_top_pad + self->scrollbar_bottom_pad;
+      }
     if (drawing_scrollbar)
       draw_scrollbar (self,
 		      self->first_shown_index, num_shown_items,
 		      0, self->view->menu->size,
 		      rightx,
-		      box_top_pad,
-		      self->bounds.height - box_top_pad - box_bottom_pad);
+		      topy,
+		      height);
   }
 
   grub_gui_restore_viewport (&vpsave);
@@ -599,6 +618,22 @@
     {
       self->scrollbar_width = grub_strtol (value, 0, 10);
     }
+  else if (grub_strcmp (name, "scrollbar_left_pad") == 0)
+    {
+      self->scrollbar_left_pad = grub_strtol (value, 0, 10);
+    }
+  else if (grub_strcmp (name, "scrollbar_right_pad") == 0)
+    {
+      self->scrollbar_right_pad = grub_strtol (value, 0, 10);
+    }
+  else if (grub_strcmp (name, "scrollbar_top_pad") == 0)
+    {
+      self->scrollbar_top_pad = grub_strtol (value, 0, 10);
+    }
+  else if (grub_strcmp (name, "scrollbar_bottom_pad") == 0)
+    {
+      self->scrollbar_bottom_pad = grub_strtol (value, 0, 10);
+    }
   else if (grub_strcmp (name, "scrollbar") == 0)
     {
       self->draw_scrollbar = grub_strcmp (value, "false") != 0;
@@ -694,6 +729,10 @@
   self->scrollbar_frame_pattern = 0;
   self->scrollbar_thumb_pattern = 0;
   self->scrollbar_width = 16;
+  self->scrollbar_left_pad = 2;
+  self->scrollbar_right_pad = 0;
+  self->scrollbar_top_pad = 0;
+  self->scrollbar_bottom_pad = 0;
 
   self->first_shown_index = 0;
 
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to