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

@ -71,9 +71,9 @@ grub_term_color_state;
/* Menu-related geometrical constants. */
/* FIXME: These should be dynamically obtained from a terminal. */
#define GRUB_TERM_WIDTH 80
#define GRUB_TERM_HEIGHT 25
/* FIXME: Ugly way to get them form terminal. */
#define GRUB_TERM_WIDTH ((grub_getwh()&0xFF00)>>8)
#define GRUB_TERM_HEIGHT (grub_getwh()&0xFF)
/* The number of lines of "GRUB version..." at the top. */
#define GRUB_TERM_INFO_HEIGHT 1
@ -142,6 +142,9 @@ struct grub_term
/* Get a character. */
int (*getkey) (void);
/* Get the screen size. The return value is ((Width << 8) | Height). */
grub_uint16_t (*getwh) (void);
/* Get the cursor position. The return value is ((X << 8) | Y). */
grub_uint16_t (*getxy) (void);
@ -183,6 +186,7 @@ void EXPORT_FUNC(grub_putchar) (int c);
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code);
int EXPORT_FUNC(grub_getkey) (void);
int EXPORT_FUNC(grub_checkkey) (void);
grub_uint16_t EXPORT_FUNC(grub_getwh) (void);
grub_uint16_t EXPORT_FUNC(grub_getxy) (void);
void EXPORT_FUNC(grub_gotoxy) (grub_uint8_t x, grub_uint8_t y);
void EXPORT_FUNC(grub_cls) (void);