2005-08-04 Marco Gerards <metgerards@student.han.nl>

* kern/term.c (grub_putcode): Use `grub_getwh' instead of
	hardcoded value.

	From Vincent Pelletier  <subdino2004@yahoo.fr>
	* include/grub/term.h (GRUB_TERM_WIDTH, GRUB_TERM_HEIGHT):
	Redefined to use grub_getwh.
	(grub_term): New member named getwh.
	(grub_getwh): New prototype.
	* kern/term.c (grub_getwh): New function.
	* term/i386/pc/console.c (grub_console_getwh): New function.
	(grub_console_term): New member `getwh'.
	* term/i386/pc/vga.c (grub_vga_getwh): New function.
	(grub_vga_term): New member `getwh'.
	* term/sparc64/ofconsole.c (grub_ofconsole_readkey): Use
	grub_ssize_t.
	(grub_ofconsole_getw): New function.
	(grub_ofconsole_init): Use grub_ssize_t and unsigned char.
	(grub_ofconsole_term): New field named getwh and new initial
	value.
This commit is contained in:
marco_g 2005-08-04 18:10:51 +00:00
parent 3be7266d92
commit 267f6cd9ca
6 changed files with 114 additions and 13 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -90,6 +90,8 @@ grub_term_get_current (void)
void
grub_putcode (grub_uint32_t code)
{
int height = grub_getwh () & 255;
if (code == '\t' && grub_cur_term->getxy)
{
int n;
@ -108,14 +110,14 @@ grub_putcode (grub_uint32_t code)
grub_putcode ('\r');
grub_more_lines++;
/* XXX: Don't use a fixed height! */
if (grub_more && grub_more_lines == 24 - 1)
if (grub_more && grub_more_lines == height - 1)
{
char key;
int pos = grub_getxy ();
/* Show --MORE-- on the lower left side of the screen. */
grub_gotoxy (1, 24 - 1);
grub_gotoxy (1, height - 1);
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
grub_printf ("--MORE--");
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
@ -123,7 +125,7 @@ grub_putcode (grub_uint32_t code)
key = grub_getkey ();
/* Remove the message. */
grub_gotoxy (1, 24 -1);
grub_gotoxy (1, height - 1);
grub_printf (" ");
grub_gotoxy (pos >> 8, pos & 0xFF);
@ -218,6 +220,12 @@ grub_getxy (void)
return (grub_cur_term->getxy) ();
}
grub_uint16_t
grub_getwh (void)
{
return (grub_cur_term->getwh) ();
}
void
grub_gotoxy (grub_uint8_t x, grub_uint8_t y)
{