Skip to contentSkip to conversation

print scrollbar in the center slice

PATCH In review Vladimir Testov 1 participant 1 message Apr 11, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 6/11 print scrollbar in the center slice

now the scrollbar is printed entirely in the east slice of menu_pixmap_style.

With this patch scrollbar is printed in the center slice if needed. Also when scrollbar is printed - width of every item is decreased (for the scrollbar to be printed)
When it's not - width remains the same as before.

I don't think this patch should go with included screenshots. But I can easily make and sent them if it will be necessary.

Signature · 4 lines
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
grub-core/gfxmenu/gui_list.c +12 -2
diff -Naur grub-new6/grub-core/gfxmenu/gui_list.c grub-new7/grub-core/gfxmenu/gui_list.c
@@ -391,16 +391,26 @@
 
     box->draw (box, 0, 0);
 
+    if (drawing_scrollbar && (self->list_version > 0))
+      {
+        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;
+      }
+
     grub_gui_set_viewport (&content_rect, &vpsave2);
     draw_menu (self, num_shown_items);
     grub_gui_restore_viewport (&vpsave2);
 
+    int rightx = self->bounds.width - box_right_pad;
+    if (self->list_version == 0)
+      rightx += self->scrollbar_width;
     if (drawing_scrollbar)
       draw_scrollbar (self,
 		      self->first_shown_index, num_shown_items,
 		      0, self->view->menu->size,
-		      self->bounds.width - box_right_pad
-		      + self->scrollbar_width,
+		      rightx,
 		      box_top_pad,
 		      self->bounds.height - box_top_pad - box_bottom_pad);
   }