SDL/src
Sam Lantinga bcf5472d16 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];
2013-10-21 02:37:03 -07:00
..
atomic Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
audio Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
core Fixed a crash initializing Android touch IDs 2013-10-20 23:23:25 -07:00
cpuinfo Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
events Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
file Fixed building using MinGW 2013-10-17 23:02:29 -07:00
filesystem Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSystemRepresentation] 2013-10-21 00:20:27 -07:00
haptic Fixed windows compile 2013-10-20 20:49:36 -07:00
input/evdev Prevent keystrokes from leaking through to the console when using evdev. 2013-10-13 17:15:43 -03:00
joystick Fixed some warnings building for 64-bit Windows 2013-10-21 01:16:16 -07:00
libm OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
loadso Rolled back my LoadLibrary change. The first failed call causes a dialog to pop up in Windows apps (but not console apps) and that's really bad. I'll have to deal with this in my app. 2013-09-28 14:06:39 -07:00
main Backed out changeset 737771c47c6f, done testing Buildbot changes. 2013-10-20 20:24:00 -04:00
power Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values. 2013-10-20 20:42:55 -07:00
render Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
stdlib Fixed building using MinGW 2013-10-17 23:02:29 -07:00
test Fixed bug 2015 - surface getting leak in SDLTest_ScreenShot function 2013-10-21 00:30:05 -07:00
thread Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values. 2013-10-20 20:42:55 -07:00
timer Fixes bug #2074 - Thanks Sylvain! 2013-08-29 14:03:44 -03:00
video Fixed bug 2073 - Mac: window moves unexpectedly when exiting SDL_WINDOW_FULLSCREEN_DESKTOP mode 2013-10-21 02:37:03 -07:00
SDL.c It's okay to quit things more than once. 2013-10-20 10:39:26 -07:00
SDL_assert.c Fixed building using MinGW 2013-10-17 23:02:29 -07:00
SDL_assert_c.h Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
SDL_error.c Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
SDL_error_c.h Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
SDL_hints.c Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
SDL_log.c Fixed building using MinGW 2013-10-17 23:02:29 -07:00