bug found and fixed

Steps to reproduce
1. more than one OS (or dummy entries as in the test stand)
2. one should have more than one kernels (so in additional options there will 
be more than one entry)
3. in main boot screen there should be enough entries so the scrollbar appears
4. we should save default boot entry from submenu and it should not be the 
first entry
5. the submenu with default entry should be at the bottom so the first shown 
entry is not the first entry of the main screen

6. move in the submenu, selected by default
7. (in the selected submenu) every entry placed before the default entry isn't 
shown. Nevertheless, they appear as soon as we press "up" key.

screeshots attached

after the patch the described problem is fixed

-- 
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru

<<attachment: BUG_1_main_boot_menu.png>>

<<attachment: BUG_2_go_into_default_submenu.png>>

<<attachment: BUG_3_press_up_key.png>>

diff -Naur grub-2.00/grub-core/gfxmenu/gui_list.c grub-fix/grub-core/gfxmenu/gui_list.c
--- grub-2.00/grub-core/gfxmenu/gui_list.c	2011-12-14 14:36:07.000000000 +0400
+++ grub-fix/grub-core/gfxmenu/gui_list.c	2013-03-27 10:04:55.000000000 +0400
@@ -541,6 +541,16 @@
   self->view = view;
 }
 
+/* Refresh list variables */
+static void
+list_refresh_info (void *vself,
+                   grub_gfxmenu_view_t view)
+{
+  list_impl_t self = vself;
+  if (view->nested)
+    self->first_shown_index = 0;
+}
+
 static struct grub_gui_component_ops list_comp_ops =
   {
     .destroy = list_destroy,
@@ -557,7 +567,8 @@
 
 static struct grub_gui_list_ops list_ops =
 {
-  .set_view_info = list_set_view_info
+  .set_view_info = list_set_view_info,
+  .refresh_list = list_refresh_info
 };
 
 grub_gui_component_t
diff -Naur grub-2.00/grub-core/gfxmenu/view.c grub-fix/grub-core/gfxmenu/view.c
--- grub-2.00/grub-core/gfxmenu/view.c	2012-02-24 14:19:45.000000000 +0400
+++ grub-fix/grub-core/gfxmenu/view.c	2013-03-27 10:08:40.967372527 +0400
@@ -237,6 +237,27 @@
 }
 
 static void
+refresh_menu_visit (grub_gui_component_t component,
+              void *userdata)
+{
+  grub_gfxmenu_view_t view;
+  view = userdata;
+  if (component->ops->is_instance (component, "list"))
+    {
+      grub_gui_list_t list = (grub_gui_list_t) component;
+      list->ops->refresh_list (list, view);
+    }
+}
+
+/* Refresh list information (useful for submenus) */
+static void
+refresh_menu_components (grub_gfxmenu_view_t view)
+{
+  grub_gui_iterate_recursively ((grub_gui_component_t) view->canvas,
+                                refresh_menu_visit, view);
+}
+
+static void
 draw_message (grub_gfxmenu_view_t view)
 {
   char *text = view->progress_message_text;
@@ -294,6 +315,7 @@
 			  view->screen.x, view->screen.y,
 			  view->screen.width, view->screen.height);
 
+  refresh_menu_components (view);
   update_menu_components (view);
 
   grub_gfxmenu_view_redraw (view, &view->screen);
diff -Naur grub-2.00/include/grub/gui.h grub-fix/include/grub/gui.h
--- grub-2.00/include/grub/gui.h	2011-05-18 17:34:32.000000000 +0400
+++ grub-fix/include/grub/gui.h	2013-03-27 10:18:55.534836740 +0400
@@ -67,6 +67,8 @@
 {
   void (*set_view_info) (void *self,
                          grub_gfxmenu_view_t view);
+  void (*refresh_list) (void *self,
+                        grub_gfxmenu_view_t view);
 };
 
 struct grub_gui_progress_ops
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to