mac: Use OSX Mavericks occlusionState API to test whether window is visible and needs drawing or not (should still work on Mountain Lion due to runtime check for API availability)

stable-5.4
Martin Plicht 2013-11-03 01:41:16 +01:00
parent 59742510d9
commit a599974a9b
1 changed files with 15 additions and 5 deletions

View File

@ -115,12 +115,22 @@
// better not to draw anything when the game has already finished
if (Application.fQuitMsgReceived)
return;
// don't draw if tab-switched away from fullscreen
if ([self.controller isFullScreenConsideringLionFullScreen] && ![NSApp isActive])
return;
if ([self.window isMiniaturized] || ![self.window isVisible])
return;
//[self.context update];
if ([NSApp respondsToSelector:@selector(occlusionState)])
{
// Mavericks - query app occlusion state
if (([NSApp occlusionState] & NSApplicationOcclusionStateVisible) == 0)
return;
}
else
{
if ([self.controller isFullScreenConsideringLionFullScreen] && ![NSApp isActive])
return;
if ([self.window isMiniaturized] || ![self.window isVisible])
return;
}
C4Window* stdWindow = self.controller.stdWindow;
if (stdWindow)