mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 18:15:10 +00:00
Fixed invalid video mode being restored.
This commit is contained in:
parent
87dd7b89f5
commit
78f1b8bd15
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,12 +222,17 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
//
|
//
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
CGDisplayFadeReservationToken token = beginFadeReservation();
|
if (monitor->ns.previousMode)
|
||||||
|
{
|
||||||
|
CGDisplayFadeReservationToken token = beginFadeReservation();
|
||||||
|
CGDisplaySetDisplayMode(monitor->ns.displayID,
|
||||||
|
monitor->ns.previousMode, NULL);
|
||||||
|
CGDisplayRelease(monitor->ns.displayID);
|
||||||
|
endFadeReservation(token);
|
||||||
|
|
||||||
CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL);
|
CGDisplayModeRelease(monitor->ns.previousMode);
|
||||||
CGDisplayRelease(monitor->ns.displayID);
|
monitor->ns.previousMode = NULL;
|
||||||
|
}
|
||||||
endFadeReservation(token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user