]> git.proxmox.com Git - grub2.git/commitdiff
2008-01-15 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Tue, 15 Jan 2008 14:05:40 +0000 (14:05 +0000)
committerrobertmh <robertmh@localhost>
Tue, 15 Jan 2008 14:05:40 +0000 (14:05 +0000)
        * normal/menu.c (run_menu): Move timeout message from here ...
        (print_timeout): ... to here.
        (run_menu): Use print_timeout() once during initial draw to print
        the whole message, and again in every clock tick to update only
        the number of seconds.

ChangeLog
normal/menu.c

index e12a1d731f30cfa8d302878350e199dd73c84db8..a93eb9d35f528bff09340f1c801d168ca1d33153 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-15  Robert Millan  <rmh@aybabtu.com>
+
+       * normal/menu.c (run_menu): Move timeout message from here ...
+       (print_timeout): ... to here.
+       (run_menu): Use print_timeout() once during initial draw to print
+       the whole message, and again in every clock tick to update only
+       the number of seconds.
+
 2008-01-15  Robert Millan  <rmh@aybabtu.com>
 
        * kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
index 0cc072602c78b3b4df7a1b856c345a3ae68b1de2..5d120b917fc07ec791395f7cb242f0a1a6f5f2a5 100644 (file)
@@ -308,12 +308,27 @@ get_entry_number (const char *name)
   return entry;
 }
 
+static void
+print_timeout (int timeout, int offset, int second_stage)
+{
+  /* NOTE: Do not remove the trailing space characters.
+     They are required to clear the line.  */
+  char *msg = "   The highlighted entry will be booted automatically in %ds.    ";
+  char *msg_end = grub_strchr (msg, '%');
+  
+  grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3);
+  grub_printf (second_stage ? msg_end : msg, timeout);
+  grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
+  grub_refresh ();
+};
+
 static int
 run_menu (grub_menu_t menu, int nested)
 {
   int first, offset;
   unsigned long saved_time;
   int default_entry;
+  int timeout;
   
   first = 0;
   
@@ -340,11 +355,14 @@ run_menu (grub_menu_t menu, int nested)
   print_entries (menu, first, offset);
   grub_refresh ();
 
+  timeout = get_timeout ();
+
+  if (timeout > 0)
+    print_timeout (timeout, offset, 0);
+
   while (1)
     {
       int c;
-      int timeout;
-
       timeout = get_timeout ();
       
       if (timeout > 0)
@@ -357,16 +375,8 @@ run_menu (grub_menu_t menu, int nested)
              timeout--;
              set_timeout (timeout);
              saved_time = current_time;
+             print_timeout (timeout, offset, 1);
            }
-         
-         grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
-         /* NOTE: Do not remove the trailing space characters.
-            They are required to clear the line.  */
-         grub_printf ("\
-   The highlighted entry will be booted automatically in %d s.    ",
-                      timeout);
-         grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
-         grub_refresh ();
        }
 
       if (timeout == 0)