From d597f23a0d441a97925ffa19036b49b4af72d317 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 3 Nov 2020 12:16:22 +1100 Subject: [PATCH] Webclient: When you close the game, exit fullscreen first. Fixes being stuck in fullscreen with image of last rendered frame when you click 'quit game' --- src/Window.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Window.c b/src/Window.c index 4ca354b11..7bbca8c5e 100644 --- a/src/Window.c +++ b/src/Window.c @@ -3513,9 +3513,12 @@ void Window_SetSize(int width, int height) { void Window_Close(void) { WindowInfo.Exists = false; Event_RaiseVoid(&WindowEvents.Closing); + /* If the game is closed while in fullscreen, the last rendered frame stays + /* shown in fullscreen, but the game can't be interacted with anymore */ + Window_ExitFullscreen(); + /* Don't want cursor stuck on the dead 0,0 canvas */ Window_DisableRawMouse(); - Window_SetSize(0, 0); UnhookEvents(); } @@ -3529,18 +3532,18 @@ static void LogStuff(void) { width = GetCanvasWidth(); height = GetCanvasHeight(); String_Format2(&str, "Size: %ix%i", &width, &height); - Chat_AddOf(&str, MSG_TYPE_STATUS_1); + Chat_AddOf(&str, MSG_TYPE_CLIENTSTATUS_1); str.length = 0; width = EM_ASM_INT_V({ return window.innerHeight; }); height = EM_ASM_INT_V({ return window.outerHeight; }); String_Format2(&str, "I:%i O:%i", &width, &height); - Chat_AddOf(&str, MSG_TYPE_STATUS_2); + Chat_AddOf(&str, MSG_TYPE_CLIENTSTATUS_2); str.length = 0; width = GetScreenWidth(); height = GetScreenHeight(); - String_Format2(&str, "Dims: %ix%i", &width, &height); + String_Format2(&str, "Dims: %ix%i |", &width, &height); Chat_AddOf(&str, MSG_TYPE_STATUS_3); } @@ -3549,6 +3552,7 @@ void Window_ProcessEvents(void) { if (Window_Debug) LogStuff(); if (!needResize) return; needResize = false; + if (!WindowInfo.Exists) return; if (Window_GetWindowState() == WINDOW_STATE_FULLSCREEN) { SetFullscreenBounds();