fix: fix Terminal app white flash

This commit is contained in:
2026-05-26 07:29:22 +02:00
parent 85128e30db
commit 80d2fb4cea
+18
View File
@@ -381,6 +381,24 @@ extern "C" void _start() {
if (!g_win.create("Terminal", INIT_W, INIT_H))
montauk::exit(1);
// The kernel seeds newly created window surfaces with white so apps that
// haven't drawn their first frame don't show as transparent/black. For
// Terminal that produces a visible white flash while we run terminal_init
// and the first TrueType render. Paint the dark background and present
// immediately so the compositor sees terminal colors from frame one.
{
uint32_t bar_px = Color::from_hex(0x1C1C1C).to_pixel();
uint32_t bg_px = colors::TERM_BG.to_pixel();
int bar_pixels = TERM_TAB_BAR_H * g_win.width;
if (bar_pixels > g_win.width * g_win.height)
bar_pixels = g_win.width * g_win.height;
for (int i = 0; i < bar_pixels; i++)
g_win.pixels[i] = bar_px;
for (int i = bar_pixels; i < g_win.width * g_win.height; i++)
g_win.pixels[i] = bg_px;
g_win.present();
}
int term_h = g_win.height - TERM_TAB_BAR_H;
g_last_win_w = g_win.width;
g_last_win_h = term_h;