2002-12-03 Yoshinori K. Okuji <okuji@enbug.org>

Change the terminal structure a bit, to turn the cursor state
	explicitly. Suggested by Pavel Roskin.

	* stage2/term.h (struct term_entry): Remove the member
	`nocursor' and add `setcursor'.
	[!STAGE1_5] (console_setcursor): New prototype.
	[SUPPORT_HERCULES] (hercules_setcursor): Likewise.
	[!STAGE1_5] (console_nocursor): Removed.
	[SUPPORT_HERCULES] (hercules_nocursor): Likewise.

	* stage2/stage2.c (run_menu): Call setcursor instead of
	nocursor.
	Call setcursor with 1 before starting a boot entry.

	* stage2/shared.h (nocursor): Removed.
	(setcursor): New prototype.

	* stage2/hercules.c (herc_cursor_state): New variable.
	(herc_turn_cursor): Removed.
	(hercules_nocursor): Likewise.
	(hercules_setcursor): New function.

	* stage2/char_io.c (get_cmdline): Turn on the cursor at the
	beginning, and restore it before returning.
	(nocursor): Removed.
	(setcursor): New function.

	* stage2/asm.S (console_cursor_state): New variable.
	(console_cursor_shape): Likewise.
	(console_setcursor): New function.
	(console_nocursor): Removed.

	* grub/asmstub.c (console_setcursor): New function.
	(hercules_setcursor): Likewise.
	(console_nocursor): Removed.
	(hercules_nocursor): Likewise.
This commit is contained in:
okuji committed 2002-12-03 00:02:53 +00:00
1 parent 58b292f419
commit c18257ea65
9 files changed
+124 -39

No files matched your search

+22 -9
View File
@@ -43,7 +43,7 @@ struct term_entry term_table[] =
console_cls,
console_setcolorstate,
console_setcolor,
console_nocursor
console_setcursor
},
#ifdef SUPPORT_SERIAL
{
@@ -73,7 +73,7 @@ struct term_entry term_table[] =
hercules_cls,
hercules_setcolorstate,
hercules_setcolor,
hercules_nocursor
hercules_setcursor
},
#endif /* SUPPORT_HERCULES */
/* This must be the last entry. */
@@ -790,6 +790,11 @@ int
get_cmdline (char *prompt, char *cmdline, int maxlen,
int echo_char, int readline)
{
int old_cursor;
int ret;
old_cursor = setcursor (1);
/* Because it is hard to deal with different conditions simultaneously,
less functional cases are handled here. Assume that TERM_NO_ECHO
implies TERM_NO_EDIT. */
@@ -811,7 +816,10 @@ get_cmdline (char *prompt, char *cmdline, int maxlen,
{
/* Return immediately if ESC is pressed. */
if (c == 27)
return 1;
{
setcursor (old_cursor);
return 1;
}
/* Printable characters are added into CMDLINE. */
if (c >= ' ' && c <= '~')
@@ -829,12 +837,15 @@ get_cmdline (char *prompt, char *cmdline, int maxlen,
if (! (current_term->flags & TERM_NO_ECHO))
grub_putchar ('\n');
setcursor (old_cursor);
return 0;
}
/* Complicated features are left to real_get_cmdline. */
return real_get_cmdline (prompt, cmdline, maxlen, echo_char, readline);
ret = real_get_cmdline (prompt, cmdline, maxlen, echo_char, readline);
setcursor (old_cursor);
return ret;
}
#endif /* STAGE1_5 */
@@ -1078,11 +1089,13 @@ cls (void)
current_term->cls ();
}
void
nocursor (void)
int
setcursor (int on)
{
if (current_term->nocursor)
current_term->nocursor ();
if (current_term->setcursor)
return current_term->setcursor (on);
return 1;
}
#endif /* ! STAGE1_5 */