Turning the Alt key into a Meta key

Jeremy Webber jeremy at cs.adelaide.edu.au
Thu May 2 09:31:13 AEST 1991


This works for me under Irix 3.2, for NeWS applications such as wsh.

Create a directory in your home directory called NeWS.
Copy /usr/NeWS/lib/NeWS/UI.ps into it.
Then apply the following patch.

Hope this helps,
	-jeremy

------- cut here and remove the .sig from the end ---
*** /usr/NeWS/lib/NeWS/UI.ps	Tue Nov 28 10:23:00 1989
--- UI.ps	Thu Feb 22 09:34:42 1990
***************
*** 1,3 ****
--- 1,10 ----
+ 
+ %  Modified at Digital Arts to make the right Alt key act like
+ %  a META key.
+ %  NB: with this patch ordinary access to the right Alt key is disabled!!
+ %
+ %  The new code is added in two places, deliniated by comments.  Look for the
+ %  keyword "meta".
  %
  %  UI.ps: low level of mouse & keyboard user interface
  %
***************
*** 467,475 ****
--- 474,512 ----
  	} ifelse
      } def
  
+ % new code for meta key
+ /MetaDown false def                   % true when either alt key is down
+ 
+ {
+     createevent dup begin		% gobble alt key
+           /Name [28560] def		% right Alt 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 {

--
--
--
Jeremy Webber			   ACSnet: jeremy at chook.ua.oz
Digital Arts Film and Television,  Internet: jeremy at cs.adelaide.edu.au
3 Milner St, Hindmarsh, SA 5007,   Voicenet: +61 8 346 4534
Australia			   Papernet: +61 8 346 4537 (FAX)



More information about the Comp.sys.sgi mailing list