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); }, eventMask);
// and tie into the keyboard manager as well // and tie into the keyboard manager if one is provided
keymgr.registerKeyObserver(new KeyboardManager.KeyObserver() { if (keymgr != null) {
public void handleKeyEvent (int id, int keyCode, long timestamp) { keymgr.registerKeyObserver(new KeyboardManager.KeyObserver() {
handleUserActivity(); public void handleKeyEvent (
} int id, int keyCode, long timestamp) {
}); handleUserActivity();
}
});
}
// register an interval to periodically check our last activity time // register an interval to periodically check our last activity time
new Interval(rqueue) { new Interval(rqueue) {
public void expired () { public void expired () {
checkIdle(); checkIdle();
} }
}.schedule(IDLE_INTERVAL, true); }.schedule(_toIdleTime/3, true);
} }
/** /**
@@ -166,8 +169,5 @@ public abstract class IdleTracker
protected long _lastEvent; protected long _lastEvent;
/** Whether the user is currently active, idle or abandoned. */ /** Whether the user is currently active, idle or abandoned. */
protected State _state; protected State _state = State.ACTIVE;
/** The delay in milliseconds between checks for user idle. */
protected static final long IDLE_INTERVAL = 60L * 1000L;
} }