From a100df9679cd0146ac486d4dad125f2b91d9a77f Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 19 Jul 2021 19:43:57 +0900 Subject: [PATCH] splash-log: handle display mode change --- apps/splash-log.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/splash-log.c b/apps/splash-log.c index 12f610fa..9604c825 100644 --- a/apps/splash-log.c +++ b/apps/splash-log.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,15 @@ static void vga_clear_screen(void) { } } +static void reinit_video(int signum) { + ioctl(framebuffer_fd, IO_VID_WIDTH, &width); + ioctl(framebuffer_fd, IO_VID_HEIGHT, &height); + ioctl(framebuffer_fd, IO_VID_DEPTH, &depth); + ioctl(framebuffer_fd, IO_VID_ADDR, &framebuffer); + ioctl(framebuffer_fd, IO_VID_SIGNAL, NULL); + signal(SIGWINEVENT, reinit_video); +} + static void check_framebuffer(void) { framebuffer_fd = open("/dev/fb0", O_RDONLY); if (framebuffer_fd >= 0) { @@ -125,11 +135,7 @@ static void check_framebuffer(void) { update_message = vga_update_message; clear_screen = vga_clear_screen; } - ioctl(framebuffer_fd, IO_VID_WIDTH, &width); - ioctl(framebuffer_fd, IO_VID_HEIGHT, &height); - ioctl(framebuffer_fd, IO_VID_DEPTH, &depth); - ioctl(framebuffer_fd, IO_VID_ADDR, &framebuffer); - ioctl(framebuffer_fd, IO_VID_SIGNAL, NULL); + reinit_video(0); } static FILE * pex_endpoint = NULL;