From 5780f60199605be8c4cea73b3218524812e68f72 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Sun, 24 Jul 2022 16:48:14 +0100 Subject: [PATCH] render static logo on exit --- src/pbsplash.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/pbsplash.c b/src/pbsplash.c index 074ec40..d4070d3 100644 --- a/src/pbsplash.c +++ b/src/pbsplash.c @@ -253,7 +253,7 @@ int main(int argc, char **argv) LOG("active tty: '%s'\n", active_tty); - if ((rc = tfb_acquire_fb(/*TFB_FL_USE_DOUBLE_BUFFER*/ 0, "/dev/fb0", + if ((rc = tfb_acquire_fb(/*TFB_FL_NO_TTY_KD_GRAPHICS */0, "/dev/fb0", active_tty)) != TFB_SUCCESS) { fprintf(stderr, "tfb_acquire_fb() failed with error code: %d\n", rc); @@ -341,26 +341,21 @@ int main(int argc, char **argv) tfb_flush_window(); tfb_flush_fb(); -#define ANIM_HEIGHT 600 + int frame = 0; int tty = open(active_tty, O_RDWR); - int tty_mode = 0; while (!terminate) { animate_frame(frame++, w, h, dpi); tfb_flush_fb(); - ioctl(tty, KDGETMODE, &tty_mode); - // Login started and has reset the TTY back to text mode - if (tty_mode == KD_TEXT) { - // tfb_flush_window(); - draw_svg(image, x, y, image_w, image_h); - goto out; - } - // usleep(1666); } - // free(animation_buf); - out: + // Before we exit print the logo so it will persist + if (image) { + ioctl(tty, KDSETMODE, KD_TEXT); + draw_svg(image, x, y, image_w, image_h); + } + nsvgDelete(font); nsvgDelete(image); // The TTY might end up in a weird state if this