term: Compatibility with latest terminal changes

This commit is contained in:
mintsuki 2022-12-14 16:19:23 +01:00
parent fc6b69f0ac
commit b3c08f8122
2 changed files with 27 additions and 0 deletions

View File

@ -218,6 +218,16 @@ static void text_set_text_bg_default(struct term_context *_ctx) {
ctx->text_palette &= 0x0f;
}
static void text_set_text_fg_default_bright(struct term_context *_ctx) {
struct textmode_context *ctx = (void *)_ctx;
ctx->text_palette = (ctx->text_palette & 0xf0) | (7 | (1 << 3));
}
static void text_set_text_bg_default_bright(struct term_context *_ctx) {
struct textmode_context *ctx = (void *)_ctx;
ctx->text_palette = (ctx->text_palette & 0x0f) | ((1 << 3) << 4);
}
static void text_putchar(struct term_context *_ctx, uint8_t c) {
struct textmode_context *ctx = (void *)_ctx;
@ -342,6 +352,8 @@ void vga_textmode_init(bool managed) {
term->set_text_bg_rgb = text_set_text_bg_rgb;
term->set_text_fg_default = text_set_text_fg_default;
term->set_text_bg_default = text_set_text_bg_default;
term->set_text_fg_default_bright = text_set_text_fg_default_bright;
term->set_text_bg_default_bright = text_set_text_bg_default_bright;
term->move_character = text_move_character;
term->scroll = text_scroll;
term->revscroll = text_revscroll;

View File

@ -366,6 +366,7 @@ static size_t margin = 64;
static size_t margin_gradient = 4;
static uint32_t default_bg, default_fg;
static uint32_t default_bg_bright, default_fg_bright;
static size_t bg_canvas_size;
static uint32_t *bg_canvas;
@ -638,6 +639,9 @@ bool gterm_init(struct fb_info **_fbs, size_t *_fbs_count,
default_bg = 0x00000000; // background (black)
default_fg = 0x00aaaaaa; // foreground (grey)
default_bg_bright = 0x00555555; // background (black)
default_fg_bright = 0x00ffffff; // foreground (grey)
char *theme_background = config_get_value(config, 0, "TERM_BACKGROUND");
if (theme_background != NULL) {
default_bg = strtoui(theme_background, NULL, 16);
@ -648,6 +652,16 @@ bool gterm_init(struct fb_info **_fbs, size_t *_fbs_count,
default_fg = strtoui(theme_foreground, NULL, 16) & 0xffffff;
}
char *theme_background_bright = config_get_value(config, 0, "TERM_BACKGROUND_BRIGHT");
if (theme_background_bright != NULL) {
default_bg_bright = strtoui(theme_background_bright, NULL, 16);
}
char *theme_foreground_bright = config_get_value(config, 0, "TERM_FOREGROUND_BRIGHT");
if (theme_foreground_bright != NULL) {
default_fg_bright = strtoui(theme_foreground_bright, NULL, 16);
}
background = NULL;
char *background_path = config_get_value(config, 0, "TERM_WALLPAPER");
if (background_path != NULL) {
@ -774,6 +788,7 @@ no_load_font:;
bg_canvas,
ansi_colours, ansi_bright_colours,
&default_bg, &default_fg,
&default_bg_bright, &default_fg_bright,
font, font_width, font_height, font_spacing,
font_scale_x, font_scale_y,
margin);