Fixed bug 2073 - Mac: window moves unexpectedly when exiting SDL_WINDOW_FULLSCREEN_DESKTOP mode
Alex Szpakowski In Mac OS X, when SDL_SetWindowFullscreen(window, 0) is called on a window which was in SDL_WINDOW_FULLSCREEN_DESKTOP mode, its original size is restored but its position is moved to the bottom of the screen. I tracked down the issue to these two lines: http://hg.libsdl.org/SDL/file/fdd5cc9e9f90/src/video/cocoa/SDL_cocoawindow.m#l1034 I believe [nswindow setFrameOrigin:rect.origin] implicitly calls [nswindow constrainFrameRect:rect toScreen:screen], which will attempt to constrain the window to the screen, but at that point the window size is still full-screen rather than the restored window size, so the constrainFrameRect function operates on the wrong window size. https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/constrainFrameRect:toScreen: I resolved the issue by swapping the order of the function calls, like so: [nswindow setContentSize:rect.size]; [nswindow setFrameOrigin:rect.origin];main
parent
d08634e2c6
commit
bcf5472d16
|
@ -1058,8 +1058,8 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
|||
}
|
||||
|
||||
s_moveHack = 0;
|
||||
[nswindow setFrameOrigin:rect.origin];
|
||||
[nswindow setContentSize:rect.size];
|
||||
[nswindow setFrameOrigin:rect.origin];
|
||||
s_moveHack = SDL_GetTicks();
|
||||
|
||||
/* When the window style changes the title is cleared */
|
||||
|
|
Loading…
Reference in New Issue