SDL2: Fix SDL_WINDOWEVENT_RESTORED firing on macOS if the window is still miniaturized during a resize #13408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check NSWindow::isVisible before sending SDL_WINDOWEVENT_RESTORED during Cocoa_WindowListener::windowDidResize
This is a backport of #13409 to SDL3
Description
Fixes
SDL_WINDOWEVENT_RESTORED
being sent to the application while the window is still miniaturized. This can happen if macOS resizes the window as a result of a display density change.This can happen if the user changes their display resolution settings in
System Preferences > Displays
from the default on a retina display to 2x the default.This can also happen if the user disconnects a non-retina display and the OS needs to move all application windows to another retina display.
In either case, any miniaturized windows will be resized accordingly while remaining miniaturized. SDL was treating all window resizes as if the window was visible and not miniaturized, which is not true.