Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
authorSam Lantinga <slouken@libsdl.org>
Thu, 10 Feb 2011 22:49:14 -0800
changeset 5248ff2564c24045
parent 5247 d844537c42fd
child 5249 7a963be087ef
Fixed cocoa trying to shuffling windows when going fullscreen on the main display.
src/video/cocoa/SDL_cocoamodes.m
     1.1 --- a/src/video/cocoa/SDL_cocoamodes.m	Thu Feb 10 22:37:01 2011 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoamodes.m	Thu Feb 10 22:49:14 2011 -0800
     1.3 @@ -258,14 +258,23 @@
     1.4          /* Restoring desktop mode */
     1.5          CGDisplaySwitchToMode(displaydata->display, data->moderef);
     1.6  
     1.7 -        CGDisplayRelease(displaydata->display);
     1.8 +        if (CGDisplayIsMain(displaydata->display)) {
     1.9 +            CGReleaseAllDisplays();
    1.10 +        } else {
    1.11 +            CGDisplayRelease(displaydata->display);
    1.12 +        }
    1.13  
    1.14          if (CGDisplayIsMain(displaydata->display)) {
    1.15              ShowMenuBar();
    1.16          }
    1.17      } else {
    1.18          /* Put up the blanking window (a window above all other windows) */
    1.19 -        result = CGDisplayCapture(displaydata->display);
    1.20 +        if (CGDisplayIsMain(displaydata->display)) {
    1.21 +            /* If we don't capture all displays, Cocoa tries to rearrange windows... *sigh* */
    1.22 +            result = CGCaptureAllDisplays();
    1.23 +        } else {
    1.24 +            result = CGDisplayCapture(displaydata->display);
    1.25 +        }
    1.26          if (result != kCGErrorSuccess) {
    1.27              CG_SetError("CGDisplayCapture()", result);
    1.28              goto ERR_NO_CAPTURE;