diff -ur grub2.color/term/gfxterm.c grub2.gfxterm/term/gfxterm.c --- grub2.color/term/gfxterm.c 2007-12-24 02:21:30.000000000 +0100 +++ grub2.gfxterm/term/gfxterm.c 2007-12-24 02:07:31.000000000 +0100 @@ -38,10 +38,13 @@ #define DEFAULT_BORDER_WIDTH 10 -#define DEFAULT_FG_COLOR 0x0a -#define DEFAULT_BG_COLOR 0x00 #define DEFAULT_CURSOR_COLOR 0x0f +static grub_uint8_t grub_gfxterm_cur_color = 0x7; +static grub_uint8_t grub_gfxterm_standard_color = 0x7; +static grub_uint8_t grub_gfxterm_normal_color = 0x7; +static grub_uint8_t grub_gfxterm_highlight_color = 0x70; + struct grub_dirty_region { int top_left_x; @@ -90,8 +93,6 @@ int cursor_state; /* Color settings. */ - grub_video_color_t fg_color_setting; - grub_video_color_t bg_color_setting; grub_video_color_t fg_color; grub_video_color_t bg_color; grub_video_color_t cursor_color; @@ -175,10 +176,8 @@ we can only have those after mode is initialized. */ grub_video_set_active_render_target (text_layer); - virtual_screen.fg_color_setting = grub_video_map_color (DEFAULT_FG_COLOR); - virtual_screen.bg_color_setting = grub_video_map_color (DEFAULT_BG_COLOR); - virtual_screen.fg_color = virtual_screen.fg_color_setting; - virtual_screen.bg_color = virtual_screen.bg_color_setting; + virtual_screen.fg_color = grub_video_map_color (grub_gfxterm_cur_color & 0x0f); + virtual_screen.bg_color = grub_video_map_color (grub_gfxterm_cur_color >> 4); virtual_screen.cursor_color = grub_video_map_color (DEFAULT_CURSOR_COLOR); grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY); @@ -805,15 +804,12 @@ static void grub_gfxterm_cls (void) { - grub_video_color_t color; - /* Clear virtual screen. */ grub_virtual_screen_cls (); /* Clear text layer. */ grub_video_set_active_render_target (text_layer); - color = virtual_screen.bg_color_setting; - grub_video_fill_rect (color, 0, 0, mode_info.width, mode_info.height); + grub_video_fill_rect (virtual_screen.bg_color, 0, 0, mode_info.width, mode_info.height); grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY); /* Mark virtual screen to be redrawn. */ @@ -823,20 +819,39 @@ static void grub_virtual_screen_setcolorstate (grub_term_color_state state) { - switch (state) - { + grub_video_color_t tmp; + + switch (state) { case GRUB_TERM_COLOR_STANDARD: + grub_gfxterm_cur_color = grub_gfxterm_standard_color; + break; case GRUB_TERM_COLOR_NORMAL: - virtual_screen.fg_color = virtual_screen.fg_color_setting; - virtual_screen.bg_color = virtual_screen.bg_color_setting; + grub_gfxterm_cur_color = grub_gfxterm_normal_color; break; case GRUB_TERM_COLOR_HIGHLIGHT: - virtual_screen.fg_color = virtual_screen.bg_color_setting; - virtual_screen.bg_color = virtual_screen.fg_color_setting; + grub_gfxterm_cur_color = grub_gfxterm_highlight_color; break; default: break; - } + } + + virtual_screen.fg_color = grub_video_map_color (grub_gfxterm_cur_color & 0x0f) | 0xff000000; + virtual_screen.bg_color = grub_video_map_color (grub_gfxterm_cur_color >> 4); +} + +static void +grub_virtual_screen_setcolor (grub_uint8_t normal_color, + grub_uint8_t highlight_color) +{ + grub_gfxterm_normal_color = normal_color; + grub_gfxterm_highlight_color = highlight_color; +} + +static void +grub_virtual_screen_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color) +{ + *normal_color = grub_gfxterm_normal_color; + *highlight_color = grub_gfxterm_highlight_color; } static void @@ -874,6 +889,8 @@ .gotoxy = grub_gfxterm_gotoxy, .cls = grub_gfxterm_cls, .setcolorstate = grub_virtual_screen_setcolorstate, + .setcolor = grub_virtual_screen_setcolor, + .getcolor = grub_virtual_screen_getcolor, .setcursor = grub_gfxterm_setcursor, .refresh = grub_gfxterm_refresh, .flags = 0, diff -ur grub2.color/video/i386/pc/vbe.c grub2.gfxterm/video/i386/pc/vbe.c --- grub2.color/video/i386/pc/vbe.c 2007-07-22 01:32:32.000000000 +0200 +++ grub2.gfxterm/video/i386/pc/vbe.c 2007-12-24 02:29:48.000000000 +0100 @@ -722,6 +722,8 @@ value |= blue << render_target->mode_info.blue_field_pos; value |= alpha << render_target->mode_info.reserved_field_pos; + grub_printf ("alpha=%x, bits=%x\n", alpha, render_target->mode_info.reserved_field_pos); + return value; }