term: Misc fixes and improvements

This commit is contained in:
mintsuki 2022-10-04 08:21:59 +02:00
parent 1c06055e6d
commit 223ebc1932
4 changed files with 18 additions and 14 deletions

View File

@ -255,7 +255,7 @@ static void text_deinit(struct term_context *_ctx, void (*_free)(void *, size_t)
static struct textmode_context term_local_struct;
void vga_textmode_init(bool managed) {
if (quiet || allocations_disallowed) {
if (quiet) {
return;
}

View File

@ -536,14 +536,12 @@ static bool last_serial = false;
static char *last_config = NULL;
bool gterm_init(char *config, size_t width, size_t height) {
if (quiet || allocations_disallowed) {
if (quiet) {
return false;
}
if (current_video_mode >= 0
#if defined (BIOS)
&& current_video_mode != 0x03
#endif
if (term != NULL
&& term_backend == GTERM
&& fbinfo.default_res == true
&& width == 0
&& height == 0
@ -554,10 +552,8 @@ bool gterm_init(char *config, size_t width, size_t height) {
return true;
}
if (current_video_mode >= 0
#if defined (BIOS)
&& current_video_mode != 0x03
#endif
if (term != NULL
&& term_backend == GTERM
&& fbinfo.framebuffer_width == width
&& fbinfo.framebuffer_height == height
&& fbinfo.framebuffer_bpp == 32

View File

@ -564,7 +564,13 @@ static void menu_init_term(void) {
if (menu_resolution != NULL)
parse_resolution(&req_width, &req_height, &req_bpp, menu_resolution);
gterm_init(NULL, req_width, req_height);
if (!gterm_init(NULL, req_width, req_height)) {
#if defined (BIOS)
vga_textmode_init(true);
#elif defined (UEFI)
panic(true, "menu: Failed to initialise terminal");
#endif
}
} else {
#if defined (BIOS)
vga_textmode_init(true);
@ -844,11 +850,13 @@ timeout_aborted:
}
if (term_backend == FALLBACK) {
gterm_init(NULL, 0, 0);
if (term == NULL) {
#if defined (BIOS)
if (term_backend == FALLBACK) {
vga_textmode_init(true);
}
#elif defined (UEFI)
panic(true, "menu: Failed to initialise terminal");
#endif
}
} else {
reset_term();
}

View File

@ -689,7 +689,7 @@ FEAT_START
gterm_init(NULL, req_width, req_height);
}
if (current_video_mode < 0) {
if (term == NULL) {
panic(true, "limine: Failed to initialise terminal");
}