Restore the desktop mode when requested

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404254
This commit is contained in:
Sam Lantinga 2009-12-02 07:55:23 +00:00
parent ae0f3ac642
commit b5fc901837

View file

@ -247,6 +247,14 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
goto ERR_NO_CAPTURE;
}
if (data == display->desktop_mode.driverdata) {
/* Restoring desktop mode */
CGDisplayRelease(displaydata->display);
if (CGDisplayIsMain(displaydata->display)) {
ShowMenuBar();
}
} else {
/* Do the physical switch */
result = CGDisplaySwitchToMode(displaydata->display, data->moderef);
if (result != kCGErrorSuccess) {
@ -258,6 +266,7 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
if (CGDisplayIsMain(displaydata->display)) {
HideMenuBar();
}
}
/* Fade in again (asynchronously) */
if (fade_token != kCGDisplayFadeReservationInvalidToken) {