signal: force minimize widnows before showing crash handler dialog (#411)

## Link to GitHub Issue, if one exists
#410 

## Description of change
Forcibly minimize all windows before showing the crash dialog. Without
this, the dialog shows "behind" the game when launching multi-monitor
fullscreen games (TDJ, VM)

## Testing
Tested TDJ and VM in fullscreen.
This commit is contained in:
bicarus-dev
2025-11-01 02:08:14 -07:00
committed by GitHub
parent 537252440e
commit 553c180bee
+8
View File
@@ -2,6 +2,7 @@
#include <atomic> #include <atomic>
#include "build/defs.h" #include "build/defs.h"
#include "hooks/graphics/graphics.h"
#include "deferlog.h" #include "deferlog.h"
#include "util/logging.h" #include "util/logging.h"
@@ -76,6 +77,13 @@ namespace deferredlogs {
void show_popup_for_crash() { void show_popup_for_crash() {
static std::once_flag shown; static std::once_flag shown;
std::call_once(shown, []() { std::call_once(shown, []() {
// minimize all windows
// only needed because in multi-monitor full screen games, MessageBox fails to show above the game
for (auto &hwnd : GRAPHICS_WINDOWS) {
ShowWindow(hwnd, SW_FORCEMINIMIZE);
}
const std::string title = "spice2x (" + to_string(VERSION_STRING_CFG) + ") - crash handler"; const std::string title = "spice2x (" + to_string(VERSION_STRING_CFG) + ") - crash handler";
std::string text; std::string text;
text += "Game has crashed.\n\n"; text += "Game has crashed.\n\n";