[comp.sys.mac.programmer] Pseudo control key for a Plus?

kenc@vaxb.acs.unt.edu (05/29/91)

I'm looking for a little advice on how to go about patching the keyboard event
mechanism on a Plus...

Basically, what I want to do is set the ctrl-key bit if the command and option
(or some other combination) are held down that the same time.  

Matter of fact, I'll need to do this before the key gets decoded, for it to do
much good.  

Would it just be easier to define my own kCHR resource?

Thanks in advance.

-- 
\  Ken Corey, VAX/Unix Programmer/Operator  (And GOD am I confused...;)  /
 \          kenc@vaxb.acs.unt.edu  ken@isect.lonestar.org               /

leonardr@sv.portal.com (Leonard Rosenthol) (06/01/91)

In article <1991May29.140048.47146@vaxb.acs.unt.edu>, kenc@vaxb.acs.unt.edu writes:
> From: kenc@vaxb.acs.unt.edu
> Newsgroups: comp.sys.mac.programmer
> Subject: Pseudo control key for a Plus?
> Date: 29 May 91 13:54:48 GMT
> Organization: University of North Texas
> 
> I'm looking for a little advice on how to go about patching the keyboard event
> mechanism on a Plus...
> 
> Basically, what I want to do is set the ctrl-key bit if the command and option
> (or some other combination) are held down that the same time.  
> 
> Matter of fact, I'll need to do this before the key gets decoded, for it to do
> much good.  
> 
> Would it just be easier to define my own kCHR resource?
> 
> Thanks in advance.
> 
	Although you COULD do it with a KCHR resource, folks running with their own keyboard layouts - like ANYONE with a non English/Roman system - would get REAL UPSET at you...
	The correct way to do this is to patch _KeyTrans which is the trap which handles the 'mapping' of raw keycodes & modifiers into the events that the program gets via GNE/WNE.   In the patch just check for you set of modifiers and then switch it to the control key instead...The only caveat of this whole process is that the Process Manager will swap your patch out EVEN DURING A MINOR CONTEXT SWITCH, so you have either a) live it with or b) munch the in memory KCHR to handle it.  b is the correct, though diff







icult solution, which we do for MicroPhone II, however a will work for most.


----------------------------------------------------------------------
+ Leonard Rosenthol                | AppleLink: MACgician            +
+ Software Ventures                | GEnie:     MACgician            +
+ Internet: leonardr@sv.portal.com | AOL:       MACgician            +
----------------------------------------------------------------------

d88-jwa@hemul.nada.kth.se (Jon W{tte) (06/01/91)

> leonardr@sv.portal.com (Leonard Rosenthol) writes:

You could try and make your lines shorter than 80 chars, so people without
X or auto-linefeed can read your posts too.

> The correct way to do this is to patch _KeyTrans which is
> the trap which handles the 'mapping' of raw keycodes & modifiers into
> the events that the program gets via GNE/WNE.  In the patch just check

What's wrong with a jGNEFilter ? Foolproof, simple and elegant.
Just remember to chain-jump, unless the value you saved from the
hook was 0, in which case you RTS. Don't know if I've ever seen
it as 0, though...

--
						Jon W{tte
						h+@nada.kth.se
						- Speed !

time@ice.com (Tim Endres) (06/01/91)

In article <D88-JWA.91Jun1112244@hemul.nada.kth.se>, d88-jwa@hemul.nada.kth.se (Jon W{tte) writes:
> > The correct way to do this is to patch _KeyTrans which is
> > the trap which handles the 'mapping' of raw keycodes & modifiers into
> > the events that the program gets via GNE/WNE.  In the patch just check
> 
> What's wrong with a jGNEFilter ? Foolproof, simple and elegant.
> Just remember to chain-jump, unless the value you saved from the
> hook was 0, in which case you RTS. Don't know if I've ever seen
> it as 0, though...
> 

Compatability?
I believe that is a "journaling" global, which Apple has nixed from
the compatability list?

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |  Voice            FAX
Whitmore Lake MI. 48189   |  (313) 449 8288   (313) 449 9208

leonardr@sv.portal.com (Leonard Rosenthol) (06/03/91)

In article <D88-JWA.91Jun1112244@hemul.nada.kth.se>, d88-jwa@hemul.nada.kth.se (Jon W{tte) writes:
> > leonardr@sv.portal.com (Leonard Rosenthol) writes:
> 
> You could try and make your lines shorter than 80 chars, so people without
> X or auto-linefeed can read your posts too.
> 
	Sorry about that, my news reader is stupider than I thought ;-)

> > The correct way to do this is to patch _KeyTrans which is
> > the trap which handles the 'mapping' of raw keycodes & modifiers into
> > the events that the program gets via GNE/WNE.  In the patch just check
> 
> What's wrong with a jGNEFilter ? Foolproof, simple and elegant.
> Just remember to chain-jump, unless the value you saved from the
> hook was 0, in which case you RTS. Don't know if I've ever seen
> it as 0, though...
> 
	jGNEFilter gets called too late in the game.  Since the intention was to map
something like the option key to the control key, you have to get in BEFORE 
dead key processing happens - remember that there are some keys which when 
used with the option key DO NOT generate events/keystrokes, but are instead
stored for reference with the next key, ie. dead keys!  The only way to handle
this situation is to get in BEFORE the dead key processing, which happens
during the _KeyTrans routine.

Leonard Rosenthol

----------------------------------------------------------------------
+ Leonard Rosenthol                | AppleLink: MACgician            +
+ Software Ventures                | GEnie:     MACgician            +
+ Internet: leonardr@sv.portal.com | AOL:       MACgician            +
----------------------------------------------------------------------

francis@daisy.uchicago.edu (Francis Stracke) (06/03/91)

In article <1991Jun2.185554.7798@svc.portal.com> leonardr@sv.portal.com (Leonard Rosenthol) writes:

>	   jGNEFilter gets called too late in the game.  Since the
	>intention was to map 
>something like the option key to the control key, you have to get in BEFORE 
>dead key processing happens - remember that there are some keys which when 
>used with the option key DO NOT generate events/keystrokes, but are instead
>stored for reference with the next key, ie. dead keys!  The only way to handle

You could remove the dead-key map....

--
/============================================================================\
| Francis Stracke	       | My opinions are my own.  I don't steal them.|
| Department of Mathematics    |=============================================|
| University of Chicago	       | Welcome to the Real World.  Enjoy the       |
| francis@zaphod.uchicago.edu  |  show.				 	     |
\============================================================================/