video: Save pending window events when a window is hidden by the window manager

The window manager might hide/unmap the window when it is minimized, in which case the fullscreen and maximized flags must be preserved as pending flags so the window will be restored to the proper state when shown/mapped on restoration.
This commit is contained in:
Frank Praznik 2024-03-03 17:55:47 -05:00
parent 9be35d4603
commit ae4484f4e5

View File

@ -3456,6 +3456,12 @@ void SDL_OnWindowShown(SDL_Window *window)
void SDL_OnWindowHidden(SDL_Window *window)
{
/* Store the maximized and fullscreen flags for restoration later, in case
* this was initiated by the window manager due to the window being unmapped
* when minimized.
*/
window->pending_flags = (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED));
/* The window is already hidden at this point, so just change the mode back if necessary. */
SDL_UpdateFullscreenMode(window, SDL_FALSE, SDL_FALSE);
}