All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] if timeout is set to zero, don't bother drawing the menu
@ 2008-02-08 16:18 Robert Millan
  2008-02-09 10:59 ` Robert Millan
  2008-02-09 20:03 ` Yoshinori K. Okuji
  0 siblings, 2 replies; 11+ messages in thread
From: Robert Millan @ 2008-02-08 16:18 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]


Fixes an ugly result of setting timeout=0.

When this is combined with the "sleep" patch I just sent, user can implement
hiddenmenu-like functionality via scripting:

echo -n "Press `ESC' to enter the menu... "
if sleep -v -i 10 ; then
  set timeout=10
else
  set timeout=0
fi

-- 
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 /.)

[-- Attachment #2: zero_timeout.diff --]
[-- Type: text/x-diff, Size: 649 bytes --]


	* normal/menu.c (run_menu): If timeout is set to zero, don't bother
	drawing the menu.

diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/normal/menu.c ./normal/menu.c
--- ../grub2/normal/menu.c	2008-01-15 15:05:40.000000000 +0100
+++ ./normal/menu.c	2008-02-08 17:11:41.000000000 +0100
@@ -339,6 +339,10 @@ run_menu (grub_menu_t menu, int nested)
   if (default_entry < 0 || default_entry >= menu->size)
     default_entry = 0;
 
+  /* If timeout is 0, drawing is pointless (and ugly).  */
+  if (get_timeout () == 0)
+    return default_entry;
+
   offset = default_entry;
   if (offset > GRUB_TERM_NUM_ENTRIES - 1)
     {

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-03-03 22:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-08 16:18 [PATCH] if timeout is set to zero, don't bother drawing the menu Robert Millan
2008-02-09 10:59 ` Robert Millan
2008-02-09 20:03 ` Yoshinori K. Okuji
2008-02-09 22:09   ` Robert Millan
2008-02-10  7:10     ` Yoshinori K. Okuji
2008-02-10 12:55       ` Robert Millan
2008-02-10 20:07         ` Yoshinori K. Okuji
2008-02-10 20:24           ` Isaac Dupree
2008-02-28 10:57   ` Robert Millan
2008-02-28 22:25     ` Yoshinori K. Okuji
2008-03-03 22:22       ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.