From 8eb91c79cb87eac2dbf8bf0a6b43c40f88483c5e Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 20 Jun 2021 03:58:22 +0200 Subject: [PATCH] Force SDL to minimize the window when focus is lost, fix #360 This was changed in SDL 2.0.14 and causes problems on several platforms and window managers. Fix taken from Yamagi Quake II --- neo/framework/Common.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/neo/framework/Common.cpp b/neo/framework/Common.cpp index d0bda134..959e7543 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.cpp @@ -2896,6 +2896,17 @@ void idCommonLocal::Init( int argc, char **argv ) { Sys_InitThreads(); +#if SDL_VERSION_ATLEAST(2, 0, 0) + /* Force the window to minimize when focus is lost. This was the + * default behavior until SDL 2.0.12 and changed with 2.0.14. + * The windows staying maximized has some odd implications for + * window ordering under Windows and some X11 window managers + * like kwin. See: + * * https://github.com/libsdl-org/SDL/issues/4039 + * * https://github.com/libsdl-org/SDL/issues/3656 */ + SDL_SetHint( SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "1" ); +#endif + try { // set interface pointers used by idLib