SCR: Mac: replace all deprecated Mac APIs as of OS 10.12.

This commit is contained in:
Charlie Fenton 2017-03-07 06:01:26 -08:00
parent 5d12d626c2
commit 58f6978c1e
1 changed files with 7 additions and 12 deletions

View File

@ -264,9 +264,6 @@ int signof(float x) {
char *msg;
CFStringRef cf_msg;
double timeToBlock, frameStartTime = getDTime();
kern_return_t kernResult = kIOReturnError;
UInt64 params;
IOByteCount rcnt = sizeof(UInt64);
double idleTime = 0;
HIThemeTextInfo textInfo;
@ -291,18 +288,16 @@ int signof(float x) {
return;
}
// For unkown reasons, OS 10.7 Lion screensaver delays several seconds after
// user activity before calling stopAnimation, so we check user activity here
// For unkown reasons, OS 10.7 Lion screensaver and later delay several seconds
// after user activity before calling stopAnimation, so we check user activity here
if ((compareOSVersionTo(10, 7) >= 0) && ((getDTime() - gSS_StartTime) > 2.0)) {
kernResult = IOHIDGetParameter( gEventHandle, CFSTR(EVSIOIDLE), sizeof(UInt64), &params, &rcnt );
if ( kernResult == kIOReturnSuccess ) {
idleTime = ((double)params) / 1000.0 / 1000.0 / 1000.0;
if (idleTime < 1.5) {
[ NSApp terminate:nil ];
}
idleTime = CGEventSourceSecondsSinceLastEventType
(kCGEventSourceStateCombinedSessionState, kCGAnyInputEventType);
if (idleTime < 1.5) {
[ NSApp terminate:nil ];
}
}
myContext = [[NSGraphicsContext currentContext] graphicsPort];
// [myContext retain];