Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!ucla-cs!zen!ucbvax!ascway.UUCP!rxb
From: rxb@ascway.UUCP (Rafael Bracho)
Newsgroups: comp.windows.news
Subject: Re: keyboard handling
Message-ID: <8707061400.AA17419@mercury.SWS-ASC.SLB.COM>
Date: Tue, 7-Jul-87 01:33:47 EDT
Article-I.D.: mercury.8707061400.AA17419
Posted: Tue Jul  7 01:33:47 1987
Date-Received: Sat, 11-Jul-87 01:53:33 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 48

Date: 6 Jul 1987 08:28-PST
From: Rafael Bracho 
Subject: Re: keyboard handling
To: uunet!steinmetz!thuban!putnam@seismo.css.gov  (putnam)
Cc: news-makers@brillig.umd.edu

Jeff,

I agree with you in that auto-repeat is an important feature missing
from NeWS 1.0; mind you, it was present in most of the older beta tapes.
Hopefully Sun will re-instate auto-repeat soon.

As for the shift keys, there is a field in the events called KeyState
which is an array of both keywords and numbers, corresponding to the
raw data obtained from the keyboard.  Thus the following event handler
returns a byte encoding the state of the keyboard (recall that the
event is put on the stack by NeWS before calling your handler):

	/HandleMouseClick {	% event => -
	    begin
	    0			% The byte we'll modify
	    KeyState length 0 ne {
		KeyState {
		    dup /Meta eq {
			pop 2#00010000 or
		    } {
			dup /Control eq {
			    pop 2#00001000 or
			} {
			    /Shift eq { 2#00000100 or } if
			} ifelse
		    } ifelse
		} forall
	    } if
	    end
	} def

(Note that I don't use a case statement because I've found it too slow
for inner-loop applications.)

There is one more problem I've found.  Often NeWS misses a shift key
completely, thus you get lowercase when you meant uppercase, or the
string "xs" is inserted in your emacs buffer when you meant to save the
file.  This seems to be a synchronization problem, but I haven't had
time to track it down.

					Rafael Bracho
					RXB@SPAR-20.ARPA