meta key
Andy Witkin
aw at B.CS.CMU.EDU
Wed Mar 8 07:57:11 AEST 1989
HOW TO INSTALL A META KEY IN IRIX 3.1
1. If you use gnu emacs, put
(setq meta-flag 1)
into your .emacs file. You need do nothing special
for unipress emacs.
2. Copy /usr/NeWS/lib/NeWS/UI.ps to ~/NeWS/UI.ps
3. Edit your private copy of UI.ps:
Find this portion:
/deliver_keyboard_to_focus { % event => -
dup dup begin % ev ev
sgi_translatekey % ev (string)
/ClientData exch def % ev
and add code before and after as follows:
/MetaDown false def % true when either alt key is down
{
createevent dup begin % gobble alt key
/Name [28560 28559] def
/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
/deliver_keyboard_to_focus { % EXISTING CODE
dup dup begin % EXISTING CODE
sgi_translatekey % EXISTING CODE
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
/ClientData exch def % EXISTING CODE
4. Log out and log back in. Alt is now a meta key. (If you get in
trouble, log in as someone else, rename ~/NeWS/UI.ps to something
else, and figure out what you did wrong.)
(This hack does two things: We fork a process that gobbles alt key
presses and maintains our /MetaDown flag. And we add some code to
deliver_keyboard_to_focus, a routine that runs whenever a key is
pressed.
deliver_keyboard_to_focus calls sgi_translatekey, sgi's routine that
takes an event and stuffs a translation string on the stack. When the
meta key is down, our added code checks to see if sgi_translatekey
left a non-empty string on top of the stack, and if so, sets the high
bit in the string's first character. The hacked string is then salted
away in the /ClientData field of the event for god-knows-who to look
at later.)
--
More information about the Comp.sys.sgi
mailing list