From: winders@aux.support.apple.com (Scott Winders)
Newsgroups: comp.sys.mac.system
Subject: Re: Killing Cmd-Opt-Space in Sys 7.x
Date: 18 Nov 92 02:46:34 GMT
Followup-To: comp.sys.mac.system
Organization: Apple Computer, Inc.

In article <1992Nov16.114430.11680@tdb.uu.se>, bredell@tdb.uu.se (Mats
Bredell) wrote:
> 
> M.A. Weissman (maw5506@ultb.isc.rit.edu) wrote:
> : I commonly use a Dvorak KCHR layout on my Mac running system 7.1.  Inside Mac
> : documents a really neat feature of switching KCHR layouts every time you hit
> : Cmd-Opt-Space.  This is great if other people wish to use my machine.
> : 
> : 	Unfortunately it is not so great if I want to zoom-out in Adobe
> : Illustrator which just so happens to use...you guessed it...Cmd-Opt-Space.
> : 
> : 	Does some kind soul out there know how to modify the system to ignore,
> : or use a different key combination, for the command.  I am familliar with 
> : ResEdit, and any help would be appreciated.
> 
> Why not yell at Adobe for using that key sequence? It's their fault if they
> use reserved key combinations.

The entries in the 'KSWP' system resource (ID = 0) is what controls
the switching of the keyboard layouts. Actually, the entries in the
'KSWP' resource control more than that. This resource is fully
documented in Inside Macintosh Volume VI, pages 14-43 to 14-44 and
pages 14-98 to 14-99.

The standard U.S. 'KSWP' resource looks like this:

  FFFF 3101 FFFC 3109
	 FFFE 4601 0000 4201
	 0000 0000

Each long word entry controls a separate function. The first 2 bytes
(integer) is the verb that the KeyScript procedure will act upon. The
third byte is the virtual key code for the key that must be pressed
and the fourth byte is the modifier state that must exist when the
key is pressed. 

Table 14-3 on page 14-44 outlines the verbs for the KeyScript procedure.

Most of the virtual key codes may be found on pages 191 and 192 of
Inside Macintosh Volume V or by using ResEdit on the 'KCHR' resource
in the System file. 

Note on modifier state: Option key down is equal to 8; Shift key down
is equal to 2; and Command key down is equal to 1. If multiple modifier
keys are pressed at the same time, their values are added together for
the modifier state entry.

The second entry in the standard U.S. 'KSWP' resource (FFFC 3109) is
the one that causes the problems you describe. The first two bytes,
$FFFC or -4, is the verb "smKeyNextKybd" which means "Switch to next
keyboard in active script". The third byte, $31, is the virtual key
code for space. The fourth byte is Command key down (1) plus the
Option key down (8) which equals $09. 

There are three methods we can use to solve the problem. One method
is to delete the entry that causes the problem. The 'KSWP' resource
would then look like this: 

  FFFF 3101 FFFE 4601
  0000 4201 0000 0000

The second method is to change the virtual key code to something
different than $31. If we change it to $4C, Command, Option, and
Enter would switch keyboard layouts. The 'KSWP' resource would look
like this:

  FFFF 3101 FFFC 4C09
	 FFFE 4601 0000 4201
	 0000 0000

The third and final method would add two new entries to the 'KSWP'
resource. One would disable switching from the current keyboard
(verb "smKeyDisableKybdSwitch") and the other would enable keyboard
switching (verb "smKeyEnableKybds"). We've set it up so Command,
Option, and Enter disable switching and Command, Option, and Return
enable switching. The 'KSWP' resource would look like this:

  FFFF 3101 FFFC 3109
  FFFE 4601 0000 4201
  FFF4 4C09 FFF9 2409
  0000 0000

Any one of the above methods will work. The first method is rather
limiting and is not very flexible. The second method is the most
straight forward and probably the best. The third method is the most
flexible and the most complicated from a user point of view.

Note: the four bytes of zeroes at the end of the resource are filler
and must be present.


Scott Winders
winders@aux.support.apple.com

"My opinions are my own, not my employer's"
Newsgroups: comp.sys.mac.system