As subject says. Based on suggestions from Vesa.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
* normal/menu.c (run_menu): Move timeout message to a separate
(local) function, print_timeout(). 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.
diff -x '*~' -x configure -x config.h.in -urp grub2/normal/menu.c test/normal/menu.c
--- grub2/normal/menu.c 2008-01-05 13:10:28.000000000 +0100
+++ test/normal/menu.c 2008-01-14 14:55:16.000000000 +0100
@@ -314,6 +314,20 @@ run_menu (grub_menu_t menu, int nested)
int first, offset;
unsigned long saved_time;
int default_entry;
+ int timeout;
+
+ auto void print_timeout (int);
+ void print_timeout (int second_stage)
+ {
+ char *prelude = " The highlighted entry will be booted automatically in";
+
+ grub_gotoxy (second_stage ? grub_strlen (prelude) : 0, GRUB_TERM_HEIGHT - 3);
+ /* NOTE: Do not remove the trailing space characters.
+ They are required to clear the line. */
+ grub_printf ("%s %ds. ", second_stage ? "" : prelude, timeout);
+ grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
+ grub_refresh ();
+ };
first = 0;
@@ -340,11 +354,14 @@ run_menu (grub_menu_t menu, int nested)
print_entries (menu, first, offset);
grub_refresh ();
+ timeout = get_timeout ();
+
+ if (timeout > 0)
+ print_timeout (0);
+
while (1)
{
int c;
- int timeout;
-
timeout = get_timeout ();
if (timeout > 0)
@@ -357,16 +374,8 @@ run_menu (grub_menu_t menu, int nested)
timeout--;
set_timeout (timeout);
saved_time = current_time;
+ print_timeout (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)
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel