最好的方式知道应用程序是否在可可mac OSX中无效? [英] Best way to know if application is inactive in cocoa mac OSX?
问题描述
所以,我正在建立一个程序,将站在展览公共使用,我有一个任务,使它处于非活动状态。只需在屏幕上显示一个文件夹中的一些随机视频,如屏幕保护程序,但在应用程序。
So, i am building a program that will stand on a exhibition for public usage, and i got a task to make a inactive state for it. Just display some random videos from a folder on the screen, like a screensaver but in the application.
那么,检查用户是否处于非活动状态的最好和正确的方法是什么?
So what is the best and proper way of checking if the user is inactive?
关于是某种全局定时器,它获得每个用户输入的重置,如果它达到让我们说1分钟进入非活动模式。有没有更好的方法?
What i am thinking about is some kind of global timer that gets reset on every user input and if it reaches lets say 1 minute it goes into inactive mode. Are there any better ways?
推荐答案
请查看本文介绍了使用IOKit从IOHID读取用户的空闲时间。
Have a look at this article covering the use of IOKit to read a users idle time from IOHID.
这篇关于最好的方式知道应用程序是否在可可mac OSX中无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!