Initial effort for gfxmenu on multiterm branch

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-26 01:49:57 +01:00
commit bee140683a
68 changed files with 5067 additions and 2577 deletions

View file

@ -351,8 +351,7 @@ static struct grub_term_output grub_console_term_output =
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_console_setcursor,
.flags = 0,
.setcursor = grub_console_setcursor
};
void
@ -366,8 +365,8 @@ grub_console_init (void)
return;
}
grub_term_register_input ("console", &grub_console_term_input);
grub_term_register_output ("console", &grub_console_term_output);
grub_term_register_input_active ("console", &grub_console_term_input);
grub_term_register_output_active ("console", &grub_console_term_output);
}
void

View file

@ -233,7 +233,11 @@ static struct grub_term_input grub_at_keyboard_term =
GRUB_MOD_INIT(at_keyboard)
{
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
grub_term_register_input_active ("at_keyboard", &grub_at_keyboard_term);
#else
grub_term_register_input ("at_keyboard", &grub_at_keyboard_term);
#endif
}
GRUB_MOD_FINI(at_keyboard)

View file

@ -65,24 +65,19 @@ static struct grub_term_output grub_console_term_output =
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_console_setcursor,
.flags = 0,
.setcursor = grub_console_setcursor
};
void
grub_console_init (void)
{
grub_term_register_output ("console", &grub_console_term_output);
grub_term_register_input ("console", &grub_console_term_input);
grub_term_register_output_active ("console", &grub_console_term_output);
grub_term_register_input_active ("console", &grub_console_term_input);
}
void
grub_console_fini (void)
{
/* This is to make sure the console is restored to text mode before
we boot. */
grub_term_set_current_output (&grub_console_term_output);
grub_term_unregister_input (&grub_console_term_input);
grub_term_unregister_output (&grub_console_term_output);
}

View file

@ -30,6 +30,7 @@
#define TEXT_WIDTH 80
#define TEXT_HEIGHT 25
static struct grub_term_output grub_serial_term_output;
static unsigned int xpos, ypos;
static unsigned int keep_track = 1;
static unsigned int registered = 0;
@ -413,7 +414,7 @@ grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
else
{
keep_track = 0;
grub_terminfo_gotoxy (x, y);
grub_terminfo_gotoxy (x, y, &grub_serial_term_output);
keep_track = 1;
xpos = x;
@ -425,7 +426,7 @@ static void
grub_serial_cls (void)
{
keep_track = 0;
grub_terminfo_cls ();
grub_terminfo_cls (&grub_serial_term_output);
keep_track = 1;
xpos = ypos = 0;
@ -439,10 +440,10 @@ grub_serial_setcolorstate (const grub_term_color_state state)
{
case GRUB_TERM_COLOR_STANDARD:
case GRUB_TERM_COLOR_NORMAL:
grub_terminfo_reverse_video_off ();
grub_terminfo_reverse_video_off (&grub_serial_term_output);
break;
case GRUB_TERM_COLOR_HIGHLIGHT:
grub_terminfo_reverse_video_on ();
grub_terminfo_reverse_video_on (&grub_serial_term_output);
break;
default:
break;
@ -454,9 +455,9 @@ static void
grub_serial_setcursor (const int on)
{
if (on)
grub_terminfo_cursor_on ();
grub_terminfo_cursor_on (&grub_serial_term_output);
else
grub_terminfo_cursor_off ();
grub_terminfo_cursor_off (&grub_serial_term_output);
}
static struct grub_term_input grub_serial_term_input =

View file

@ -163,12 +163,16 @@ static struct grub_term_output grub_vga_text_term =
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_vga_text_setcursor,
.setcursor = grub_vga_text_setcursor
};
GRUB_MOD_INIT(vga_text)
{
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
grub_term_register_output_active ("vga_text", &grub_vga_text_term);
#else
grub_term_register_output ("vga_text", &grub_vga_text_term);
#endif
}
GRUB_MOD_FINI(vga_text)

View file

@ -414,15 +414,14 @@ static struct grub_term_output grub_ofconsole_term_output =
.setcolor = grub_ofconsole_setcolor,
.getcolor = grub_ofconsole_getcolor,
.setcursor = grub_ofconsole_setcursor,
.refresh = grub_ofconsole_refresh,
.flags = 0,
.refresh = grub_ofconsole_refresh
};
void
grub_console_init (void)
{
grub_term_register_input ("ofconsole", &grub_ofconsole_term_input);
grub_term_register_output ("ofconsole", &grub_ofconsole_term_output);
grub_term_register_input_active ("ofconsole", &grub_ofconsole_term_input);
grub_term_register_output_active ("ofconsole", &grub_ofconsole_term_output);
}
void

View file

@ -108,52 +108,52 @@ grub_terminfo_set_current (const char *str)
/* Wrapper for grub_putchar to write strings. */
static void
putstr (const char *str)
putstr (const char *str, grub_term_output_t oterm)
{
while (*str)
grub_putchar (*str++);
grub_putcode (*str++, oterm);
}
/* Move the cursor to the given position starting with "0". */
void
grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y)
grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y, grub_term_output_t oterm)
{
putstr (grub_terminfo_tparm (term.gotoxy, y, x));
putstr (grub_terminfo_tparm (term.gotoxy, y, x), oterm);
}
/* Clear the screen. */
void
grub_terminfo_cls (void)
grub_terminfo_cls (grub_term_output_t oterm)
{
putstr (grub_terminfo_tparm (term.cls));
putstr (grub_terminfo_tparm (term.cls), oterm);
}
/* Set reverse video mode on. */
void
grub_terminfo_reverse_video_on (void)
grub_terminfo_reverse_video_on (grub_term_output_t oterm)
{
putstr (grub_terminfo_tparm (term.reverse_video_on));
putstr (grub_terminfo_tparm (term.reverse_video_on), oterm);
}
/* Set reverse video mode off. */
void
grub_terminfo_reverse_video_off (void)
grub_terminfo_reverse_video_off (grub_term_output_t oterm)
{
putstr (grub_terminfo_tparm (term.reverse_video_off));
putstr (grub_terminfo_tparm (term.reverse_video_off), oterm);
}
/* Show cursor. */
void
grub_terminfo_cursor_on (void)
grub_terminfo_cursor_on (grub_term_output_t oterm)
{
putstr (grub_terminfo_tparm (term.cursor_on));
putstr (grub_terminfo_tparm (term.cursor_on), oterm);
}
/* Hide cursor. */
void
grub_terminfo_cursor_off (void)
grub_terminfo_cursor_off (grub_term_output_t oterm)
{
putstr (grub_terminfo_tparm (term.cursor_off));
putstr (grub_terminfo_tparm (term.cursor_off), oterm);
}
/* GRUB Command. */