Force SDL to minimize the window when focus is lost.

This was the default until 2.0.12 and is what the expects. It changed
with 2.0.14, casing problems with window ordering under windows and
some X11 window managers like kwin.

Do it unconditionally. So we're shure that we're ending with a minimized
windows, no matter what SDL does.

Fixes part of #647.
This commit is contained in:
Yamagi 2021-03-17 09:18:02 +01:00
parent 51746d6980
commit 11bcb785d0
1 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,15 @@ CreateSDLWindow(int flags, int w, int h)
last_position_x = last_position_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY((int)vid_displayindex->value);
}
/* 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");
window = SDL_CreateWindow("Yamagi Quake II", last_position_x, last_position_y, w, h, flags);
if (window)