Cope with a lack of a KeyboardManager, base our idle check time on our minimum

idle time.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4206 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-06-21 08:14:45 +00:00
parent 85d60b6520
commit 0d887c9ede
+11 -11
View File
@@ -64,19 +64,22 @@ public abstract class IdleTracker
}
}, eventMask);
// and tie into the keyboard manager as well
keymgr.registerKeyObserver(new KeyboardManager.KeyObserver() {
public void handleKeyEvent (int id, int keyCode, long timestamp) {
handleUserActivity();
}
});
// and tie into the keyboard manager if one is provided
if (keymgr != null) {
keymgr.registerKeyObserver(new KeyboardManager.KeyObserver() {
public void handleKeyEvent (
int id, int keyCode, long timestamp) {
handleUserActivity();
}
});
}
// register an interval to periodically check our last activity time
new Interval(rqueue) {
public void expired () {
checkIdle();
}
}.schedule(IDLE_INTERVAL, true);
}.schedule(_toIdleTime/3, true);
}
/**
@@ -166,8 +169,5 @@ public abstract class IdleTracker
protected long _lastEvent;
/** Whether the user is currently active, idle or abandoned. */
protected State _state;
/** The delay in milliseconds between checks for user idle. */
protected static final long IDLE_INTERVAL = 60L * 1000L;
protected State _state = State.ACTIVE;
}