Fixed bug 3719 - Cocoa - Incorrect window size when leaving fullscreen

bastien.bouclet

When exiting a "fullscreen space" on OS X, windows don't go to their defined "windowed mode size", but go back to their previous size.

Steps to reproduce:
1. Create a windowed mode SDL window
2. Toggle it to fullscreen with the SDL_WINDOW_FULLSCREEN_DESKTOP flag
3. While in fullscreen, change the windowed mode size using SDL_SetWindowSize
4. Toggle the window back to windowed mode

Expected result:
- The window has the size specified during step 3.

Actual result:
- The window has the size specified when creating the window in step 1.

Attached is a minimal reproduction test case.
The attached test case works as expected on X11 and Windows.
This commit is contained in:
Sam Lantinga 2017-08-29 21:42:22 -07:00
parent 846a9ab95e
commit 8fc1fb0805

View File

@ -752,12 +752,21 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
[NSMenu setMenuBarVisible:YES]; [NSMenu setMenuBarVisible:YES];
pendingWindowOperation = PENDING_OPERATION_NONE; pendingWindowOperation = PENDING_OPERATION_NONE;
/* Force the size change event in case it was delivered earlier
while the window was still animating into place. /* Restore windowed size and position in case it changed while fullscreen */
*/ {
window->w = 0; NSRect rect;
window->h = 0; rect.origin.x = window->windowed.x;
[self windowDidResize:aNotification]; rect.origin.y = window->windowed.y;
rect.size.width = window->windowed.w;
rect.size.height = window->windowed.h;
ConvertNSRect([nswindow screen], NO, &rect);
s_moveHack = 0;
[nswindow setContentSize:rect.size];
[nswindow setFrameOrigin:rect.origin];
s_moveHack = SDL_GetTicks();
}
/* FIXME: Why does the window get hidden? */ /* FIXME: Why does the window get hidden? */
if (window->flags & SDL_WINDOW_SHOWN) { if (window->flags & SDL_WINDOW_SHOWN) {