[comp.sys.mac] Detecting Idle

lih@cunixd.cc.columbia.edu (Andrew Lih) (06/01/89)

I am presently developing a system here at Columbia University to
provide user authentication before letting a user use a Macintosh.
This consists of having an INIT that, after having the Mac start up
the Finder, places a *modal* dialog box on the screen which prompts
for a username and a password.  When these two are entered, the
information is sent to a UNIX daemon which checks whether the username
combo is correct by matching it against /etc/passwd.

If the login is valid, then control of the Mac is turned over to the
user.  (We would also like to automatically mount an AppleShare volume
at this time via CAP/AUFS at this time, however this is left for
future work)

If the login is not valid, then the dialog prompting for username and
password is displayed again and the Mac is not allowed to be used
until a valid username-password combo is entered.

The problem:

In our project, on the Mac side we check to see if the user idles for
more than a minute (or whatever time length we specify).  If he idles
for more than a minute, a dialog pops up and counts down from 60
seconds and says, "Idle logout in X seconds".  The problem is that our
routine does not seem to be picking up the key events, only the mouse
events, so even if the person has been typing for a whole minute, it
will still pop up the idle logout dialog.  This is not good, since
there are many times when a person does not touch a mouse for several
minutes at a time.

Could any of you who have written screen savers or have dealt with
detecting idle time give me any hints as to why this is not working
correctly?  This is the condition for LightSpeed C v2.15 that we use
to check:

	if (mMoved(&auStg->gMouse) ||
		EventAvail(keyDown|keyUp|autokey,&theEvt)) {
		auStg->aTick=0;
		return(false);
	}

Notes:	auStg->gMouse	global mouse position from previous call
	auStg->aTick	aTick=0 if there was activity detected
			otherwise, contains seconds to countdown
			before idle logout.

It should pick up key events as well, but it does not seem to do this.

Any help would be greatly appreciated.  Thanks in advance!

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 """""""   Andrew "Fuz" Lih	              Columbia University Center
 | @ @ |   Instructional Computing	      for Computing Activities
 <  ^  >					
  \ - /    lih@cunixc.cc.columbia.edu	      AJLUS@CUVMB.BITNET
   --- 	   lih@heathcliff.cs.columbia.edu  ...rutgers!columbia!cunixc!lih
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 """""""   Andrew "Fuz" Lih	              Columbia University Center
 | @ @ |   Instructional Computing	      for Computing Activities
 <  ^  >					
  \ - /    lih@cunixc.cc.columbia.edu	      AJLUS@CUVMB.BITNET
   --- 	   lih@heathcliff.cs.columbia.edu  ...rutgers!columbia!cunixc!lih
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=