Skip to content

Commit

Permalink
debug: Prevent FATAL error from being overwritten in popup
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Oct 31, 2023
1 parent ff7f04c commit ff888e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/framework/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion lib/framework/wzapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions lib/sdl/main_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit ff888e0

Please sign in to comment.