shithub: choc

Download patch

ref: 9dc7a7f5d543317b2fd7c63a4ca1c3d14eebf205
parent: 949c81d7f1d5868caa3ccd6a3f44aa86a179f34a
parent: d57e99cf20ccd8cf736c6bcc0f88fbf95a6aa7ce
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Dec 27 06:19:24 EST 2021

Merge pull request #1397 from tpoppins/sdl2-alttab-fix

Fixes Alt+Tab bug with SDL2 v2.0.14+ on Windows

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1349,6 +1349,18 @@
                                 SDL_TEXTUREACCESS_STREAMING,
                                 SCREENWIDTH, SCREENHEIGHT);
 
+    // Workaround for SDL 2.0.14+ alt-tab bug (taken from Doom Retro via Prboom-plus and Woof)
+#if defined(_WIN32)
+    {
+        SDL_version ver;
+        SDL_GetVersion(&ver);
+        if (ver.major == 2 && ver.minor == 0 && (ver.patch == 14 || ver.patch == 16))
+        {
+           SDL_SetHintWithPriority(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "1", SDL_HINT_OVERRIDE);
+        }
+    }
+#endif
+
     // Initially create the upscaled texture for rendering to screen
 
     CreateUpscaledTexture(true);