This patch fixes the terminal-box's background (center image) not update with terminal window's dirty area updates. If black is set as font's background color, as it is designated as transparent color, the terminal-box background will be displayed instead of black color.
This makes terminal windows's background theme-able. Signed-off-by: Michael Chang <[email protected]> --- grub-core/gfxmenu/view.c | 2 ++ grub-core/gfxmenu/widget-box.c | 7 +++++++ grub-core/term/gfxterm.c | 15 ++++++++++++++- include/grub/gfxterm.h | 1 + include/grub/gfxwidgets.h | 1 + 5 files changed, 25 insertions(+), 1 deletions(-) diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c index 9023fd3..81c696d 100644 --- a/grub-core/gfxmenu/view.c +++ b/grub-core/gfxmenu/view.c @@ -356,6 +356,8 @@ grub_gfxmenu_draw_terminal_box (void) term_box->draw (term_box, term_rect.x - term_box->get_left_pad (term_box), term_rect.y - term_box->get_top_pad (term_box)); + + bitmap_hook = term_box->get_center_scaled_pixmap(term_box); } static void diff --git a/grub-core/gfxmenu/widget-box.c b/grub-core/gfxmenu/widget-box.c index 18e2ef4..fe1a1ee 100644 --- a/grub-core/gfxmenu/widget-box.c +++ b/grub-core/gfxmenu/widget-box.c @@ -172,6 +172,12 @@ set_content_size (grub_gfxmenu_box_t self, return; } +static struct grub_video_bitmap* +get_center_scaled_pixmap (grub_gfxmenu_box_t self) +{ + return (self->scaled_pixmaps[BOX_PIXMAP_CENTER]); +} + static int get_border_width (grub_gfxmenu_box_t self) { @@ -329,6 +335,7 @@ grub_gfxmenu_create_box (const char *pixmaps_prefix, box->draw = draw; box->set_content_size = set_content_size; + box->get_center_scaled_pixmap = get_center_scaled_pixmap; box->get_border_width = get_border_width; box->get_left_pad = get_left_pad; diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index c995b84..ecb8e22 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -111,6 +111,7 @@ struct grub_gfxterm_window static struct grub_video_render_target *render_target; void (*grub_gfxterm_decorator_hook) (void) = NULL; +struct grub_video_bitmap *bitmap_hook = NULL; static struct grub_gfxterm_window window; static struct grub_virtual_screen virtual_screen; static grub_gfxterm_repaint_callback_t repaint_callback; @@ -347,6 +348,7 @@ grub_gfxterm_fullscreen (void) font_name = ""; /* Allow fallback to any font. */ grub_gfxterm_decorator_hook = NULL; + bitmap_hook = NULL; return grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY, 0, 0, mode_info.width, mode_info.height, @@ -425,6 +427,17 @@ redraw_screen_rect (unsigned int x, unsigned int y, (unsigned *) &saved_view.height); grub_video_set_viewport (window.x, window.y, window.width, window.height); + if (bitmap_hook) + { + /* Render bitmap as background. */ + grub_video_blit_bitmap (bitmap_hook, GRUB_VIDEO_BLIT_REPLACE, x, y, + x - virtual_screen.offset_x, + y - virtual_screen.offset_y, + width, height); + blend_text_bg = 1; + + } + if (bitmap) { /* Render bitmap as background. */ @@ -472,7 +485,7 @@ redraw_screen_rect (unsigned int x, unsigned int y, grub_video_fill_rect (color, x, ty, width, h); } } - else + else if (!bitmap_hook) { /* Render background layer. */ color = virtual_screen.bg_color_display; diff --git a/include/grub/gfxterm.h b/include/grub/gfxterm.h index 3fc8d92..61e001a 100644 --- a/include/grub/gfxterm.h +++ b/include/grub/gfxterm.h @@ -38,5 +38,6 @@ void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func); void EXPORT_FUNC (grub_gfxterm_schedule_repaint) (void); extern void (*EXPORT_VAR (grub_gfxterm_decorator_hook)) (void); +extern struct grub_video_bitmap *EXPORT_VAR(bitmap_hook); #endif /* ! GRUB_GFXTERM_HEADER */ diff --git a/include/grub/gfxwidgets.h b/include/grub/gfxwidgets.h index 8ce666c..9cecf0e 100644 --- a/include/grub/gfxwidgets.h +++ b/include/grub/gfxwidgets.h @@ -36,6 +36,7 @@ struct grub_gfxmenu_box void (*draw) (grub_gfxmenu_box_t self, int x, int y); void (*set_content_size) (grub_gfxmenu_box_t self, int width, int height); + struct grub_video_bitmap* (*get_center_scaled_pixmap) (grub_gfxmenu_box_t self); int (*get_border_width) (grub_gfxmenu_box_t self); int (*get_left_pad) (grub_gfxmenu_box_t self); int (*get_top_pad) (grub_gfxmenu_box_t self); -- 1.7.3.4 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
