# HG changeset patch # User Sam Lantinga # Date 1259740523 0 # Node ID b66c9e8090d4db715cce9e155aaf1be638e5bc5e # Parent 5ffbbfb78987b1efab822e228d9dae4db2460cc8 Restore the desktop mode when requested diff -r 5ffbbfb78987 -r b66c9e8090d4 src/video/cocoa/SDL_cocoamodes.m --- a/src/video/cocoa/SDL_cocoamodes.m Wed Dec 02 07:42:10 2009 +0000 +++ b/src/video/cocoa/SDL_cocoamodes.m Wed Dec 02 07:55:23 2009 +0000 @@ -247,16 +247,25 @@ goto ERR_NO_CAPTURE; } - /* Do the physical switch */ - result = CGDisplaySwitchToMode(displaydata->display, data->moderef); - if (result != kCGErrorSuccess) { - CG_SetError("CGDisplaySwitchToMode()", result); - goto ERR_NO_SWITCH; - } + if (data == display->desktop_mode.driverdata) { + /* Restoring desktop mode */ + CGDisplayRelease(displaydata->display); - /* Hide the menu bar so it doesn't intercept events */ - if (CGDisplayIsMain(displaydata->display)) { - HideMenuBar(); + if (CGDisplayIsMain(displaydata->display)) { + ShowMenuBar(); + } + } else { + /* Do the physical switch */ + result = CGDisplaySwitchToMode(displaydata->display, data->moderef); + if (result != kCGErrorSuccess) { + CG_SetError("CGDisplaySwitchToMode()", result); + goto ERR_NO_SWITCH; + } + + /* Hide the menu bar so it doesn't intercept events */ + if (CGDisplayIsMain(displaydata->display)) { + HideMenuBar(); + } } /* Fade in again (asynchronously) */