diff --git a/clientscr/Mac_Saver_ModuleView.m b/clientscr/Mac_Saver_ModuleView.m index d488a5f82e..35380fb3fa 100644 --- a/clientscr/Mac_Saver_ModuleView.m +++ b/clientscr/Mac_Saver_ModuleView.m @@ -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), ¶ms, &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];