Re: How to setup idle timer in 64-bit 10.6?
Re: How to setup idle timer in 64-bit 10.6?
- Subject: Re: How to setup idle timer in 64-bit 10.6?
- From: Marc Respass <email@hidden>
- Date: Tue, 11 May 2010 10:33:28 -0400
Thanks Kevin,
Thanks also to Paul Sanders and Jean-Daniel Dupas. The advice to use an NSApplication subclass overriding sendEvent: along with noodlesoft's timer setup works perfectly.
In my application, the app is "locked" after an idle time and the user must authenticate again. I put a flag (BOOL idleTimerRunning) in my application subclass (IdleApplication). I check idleTimerRunning in sendEvent: and if NO then toggle to YES and setup the timer. Noodlesoft's performSelector:withObject:afterSystemIdleTime: handles resetting a timer until the idle period passes. I invoke a selector on the correct object which does what I need. When the user re-authenticates, I just [(IdleApplication *)NSApp setIdleTimerRunning:NO]; which will get toggled in sendEvent:. My test app works perfectly.
Thanks so much everyone
Marc
El May 10, 2010, a las 10:07 PM, Kevin Wojniak escribió:
> CGEventSourceSecondsSinceLastEventType() is what you want. See here:
> http://www.noodlesoft.com/blog/2008/01/08/idle-hands/
>
>
> On May 10, 2010, at 1:26 PM, Marc Respass wrote:
>
>> Hi All,
>>
>> My application has a requirement that it "locks out" the user after X minutes of inactivity. I was using Uli Kusterer's excellent UKIdleTimer in my application and it worked great. Then I upgraded to 64-bit and it does not work any more. Does anyone have a good replacement or is my best bet to just go back to 32 bit? There are some new 10.6 event methods that I tried but they are more the opposite of an idle timer. It lets me handle all kinds of events but not "no event." I couldn't get that work well for me. If anyone has a recommendation, I would really appreciate it.
>>
>> Thanks a lot
>> Marc
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden