Replace grub_checkkey with grub_getkey_noblock.

* grub-core/kern/term.c (grub_checkkey): Replaced with ...
	(grub_getkey_noblock): ... this. All users updated.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-18 19:59:01 +01:00
parent b500bcfeed
commit a8f16eab1a
7 changed files with 28 additions and 36 deletions

View file

@ -41,7 +41,7 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
grub_file_t file;
char buf[GRUB_DISK_SECTOR_SIZE];
grub_ssize_t size;
int key = 0;
int key = GRUB_TERM_NO_KEY;
if (state[0].set)
dos = 1;
@ -77,8 +77,7 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
}
}
while (grub_checkkey () >= 0 &&
(key = grub_getkey ()) != GRUB_TERM_ESC)
while ((key = grub_getkey_noblock ()) != GRUB_TERM_ESC)
;
}

View file

@ -151,7 +151,7 @@ play (unsigned tempo, struct note *note)
{
unsigned int to;
if (note->pitch == T_FINE || grub_checkkey () >= 0)
if (note->pitch == T_FINE || grub_getkey_noblock () != GRUB_TERM_NO_KEY)
return 1;
grub_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
@ -169,7 +169,8 @@ play (unsigned tempo, struct note *note)
}
to = grub_get_rtc () + BASE_TEMPO * note->duration / tempo;
while (((unsigned int) grub_get_rtc () <= to) && (grub_checkkey () < 0))
while (((unsigned int) grub_get_rtc () <= to)
&& (grub_getkey_noblock () == GRUB_TERM_NO_KEY))
;
return 0;
@ -261,9 +262,6 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
beep_off ();
while (grub_checkkey () > 0)
grub_getkey ();
return 0;
}

View file

@ -54,7 +54,7 @@ grub_interruptible_millisleep (grub_uint32_t ms)
start = grub_get_time_ms ();
while (grub_get_time_ms () - start < ms)
if (grub_checkkey () >= 0 && grub_getkey () == GRUB_TERM_ESC)
if (grub_getkey_noblock () == GRUB_TERM_ESC)
return 1;
return 0;