Fixed invalid video mode being restored.

This commit is contained in:
Camilla Berglund 2014-03-10 12:42:30 +01:00
parent 87dd7b89f5
commit 78f1b8bd15

View File

@ -200,10 +200,8 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID); monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
CGDisplayFadeReservationToken token = beginFadeReservation(); CGDisplayFadeReservationToken token = beginFadeReservation();
CGDisplayCapture(monitor->ns.displayID); CGDisplayCapture(monitor->ns.displayID);
CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL); CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL);
endFadeReservation(token); endFadeReservation(token);
} }
@ -223,13 +221,18 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
// Restore the previously saved (original) video mode // Restore the previously saved (original) video mode
// //
void _glfwRestoreVideoMode(_GLFWmonitor* monitor) void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
{
if (monitor->ns.previousMode)
{ {
CGDisplayFadeReservationToken token = beginFadeReservation(); CGDisplayFadeReservationToken token = beginFadeReservation();
CGDisplaySetDisplayMode(monitor->ns.displayID,
CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL); monitor->ns.previousMode, NULL);
CGDisplayRelease(monitor->ns.displayID); CGDisplayRelease(monitor->ns.displayID);
endFadeReservation(token); endFadeReservation(token);
CGDisplayModeRelease(monitor->ns.previousMode);
monitor->ns.previousMode = NULL;
}
} }