Key mappings under 4Sight 1.0

Scott Henry scotth at corp.sgi.com
Sat Feb 10 04:46:43 AEST 1990


I have a hack to /usr/NeWS/lib/NeWS/UI.ps that makes the Alt keys act like
Meta keys to GNU Emacs (it was posted to the net a while ago, I forgot by
who). However, there is a big GOTCHA with this patch -- everything else on
the system which looks for the Alt keys won't find them, including X11!
Not being a NeWS hacker, I wasn't able to make it work as both.  I am
including a context diff of the 3.2 UI.ps (put the patched version in
~/NeWS/UI.ps so as not to screw-up anybody else who may use your system,
and to have a backup if it fails in a future release).

Disclaimer: this is public domain and is not supported in any way by SGI.

*** /usr/NeWS/lib/NeWS/UI.ps	Thu Mar  9 16:51:01 1989
--- UI.ps	Wed Mar  8 09:39:49 1989
***************
*** 318,326 ****
--- 318,358 ----
  	} ifelse
      } def
  
+ % new code for meta key
+ /MetaDown false def			% true when either alt key is down
+ 
+ {
+     createevent dup begin 		% gobble alt key
+                                         % Do not eat the right ctrl key.
+                                         % We will need it to swap with capslock
+                                         % in user.ps.
+ 	    /Name [28419 28560 28559] def % first one is left ctrl key
+ 	    /Priority 4 def
+ 	    /Exclusivity true def
+ 	end
+     expressinterest
+     {
+ 	awaitevent
+ 	dup /Action get /DownTransition eq
+ 		{/MetaDown true store}     % downtrans -> set  flag
+ 		{/MetaDown false store}	   % uptrans -> clear flag
+ 	ifelse
+     } loop
+ } fork
+ %end new code
+ 
      /deliver_keyboard_to_focus {				% event => -
  	dup dup begin						% ev ev
  	    sgi_translatekey					% ev (string)
+ % new code for meta key
+ 	    dup dup type /stringtype eq		% if there's a string
+ 	    exch length 0 ne and		% of nonzero length
+ 	    MetaDown and			% and meta is down
+ 	    Action /DownTransition eq and	% and ev is a keypress
+ 	    {dup dup 0 get 128 or		% then ior 128 into
+ 	     0 exch put				% the 1st char in the string
+ 	    } if
+ % end new code
  	    /ClientData exch def				% ev
  	end
  	InteractionLock monitorlocked MenuBusy 0 ne or {
*********************

remember, this is an either/or patch -- you can't have it both ways!

--
  Scott Henry <scotth at sgi.com>	| These are my	| Tardis Express -- when it
  Information Services,		| Opinions only!| absolutely, positively
  Silicon Graphics, Inc		| Whose else?	| has to be there -- yesterday.



More information about the Comp.sys.sgi mailing list