mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
By default minimize real fullscreen windows when they lose focus so the desktop video mode is restored.
This fixes https://github.com/libsdl-org/SDL/issues/4039
This commit is contained in:
parent
1e07dba09b
commit
8e35ff5cb3
@ -2887,6 +2887,8 @@ SDL_OnWindowFocusGained(SDL_Window * window)
|
||||
static SDL_bool
|
||||
ShouldMinimizeOnFocusLoss(SDL_Window * window)
|
||||
{
|
||||
const char *hint;
|
||||
|
||||
if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
@ -2908,6 +2910,15 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */
|
||||
hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS);
|
||||
if (!hint || !*hint || SDL_strcasecmp(hint, "auto") == 0) {
|
||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||
return SDL_FALSE;
|
||||
} else {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
return SDL_GetHintBoolean(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_FALSE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user