From ff888e0d7f4f4519d8206055c4f884969445a0c2 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 30 Oct 2023 18:13:47 -0400 Subject: [PATCH] debug: Prevent FATAL error from being overwritten in popup --- lib/framework/debug.cpp | 2 +- lib/framework/wzapp.h | 2 +- lib/sdl/main_sdl.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/framework/debug.cpp b/lib/framework/debug.cpp index b9444143d1e..d8b22ce8d2a 100644 --- a/lib/framework/debug.cpp +++ b/lib/framework/debug.cpp @@ -580,7 +580,7 @@ void _debug(int line, code_part part, const char *function, const char *str, ... { if (wzIsFullscreen()) { - wzChangeWindowMode(WINDOW_MODE::windowed); + wzChangeWindowMode(WINDOW_MODE::windowed, true); } #if defined(WZ_OS_WIN) char wbuf[MAX_LEN_LOG_LINE+512]; diff --git a/lib/framework/wzapp.h b/lib/framework/wzapp.h index a91f39dc2f7..a45a20516ba 100644 --- a/lib/framework/wzapp.h +++ b/lib/framework/wzapp.h @@ -86,7 +86,7 @@ WINDOW_MODE wzGetNextWindowMode(WINDOW_MODE currentMode); WINDOW_MODE wzAltEnterToggleFullscreen(); bool wzSetToggleFullscreenMode(WINDOW_MODE fullscreenMode); WINDOW_MODE wzGetToggleFullscreenMode(); -bool wzChangeWindowMode(WINDOW_MODE mode); +bool wzChangeWindowMode(WINDOW_MODE mode, bool silent = false); WINDOW_MODE wzGetCurrentWindowMode(); bool wzIsFullscreen(); void wzSetWindowIsResizable(bool resizable); diff --git a/lib/sdl/main_sdl.cpp b/lib/sdl/main_sdl.cpp index b5fb3f2a7c8..4a7ac1bd383 100644 --- a/lib/sdl/main_sdl.cpp +++ b/lib/sdl/main_sdl.cpp @@ -676,7 +676,7 @@ WINDOW_MODE wzGetToggleFullscreenMode() return altEnterToggleFullscreenMode; } -bool wzChangeWindowMode(WINDOW_MODE mode) +bool wzChangeWindowMode(WINDOW_MODE mode, bool silent) { auto currMode = wzGetCurrentWindowMode(); if (currMode == mode) @@ -691,7 +691,10 @@ bool wzChangeWindowMode(WINDOW_MODE mode) return false; } - debug(LOG_INFO, "Changing window mode: %s -> %s", to_display_string(currMode).c_str(), to_display_string(mode).c_str()); + if (!silent) + { + debug(LOG_INFO, "Changing window mode: %s -> %s", to_display_string(currMode).c_str(), to_display_string(mode).c_str()); + } int sdl_result = -1; switch (mode)