Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Restore the desktop mode when requested
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 2, 2009
1 parent 359a8f3 commit 7db67d3
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/video/cocoa/SDL_cocoamodes.m
Expand Up @@ -247,16 +247,25 @@ - (void) setFrame:(NSRect)frame;
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);

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();
/* Hide the menu bar so it doesn't intercept events */
if (CGDisplayIsMain(displaydata->display)) {
HideMenuBar();
}
}

/* Fade in again (asynchronously) */
Expand Down

0 comments on commit 7db67d3

Please sign in to comment.