[comp.windows.x] International Keyboards and Modifier Combinations

mikep@sco.COM (Mike Patnode) (04/10/90)

I have some questions concerning international keyboard support and
combinations of modifier keys.

Many international keyboards work with a variety of modifier keys.  For
instance, in order to use the IBM PC/AT keyboard in foreign countries,
many combinations of the Alt, Ctrl and Shift keys are used to generate
different characters.  Other keyboards contain a second or third key for
accessing different KeyTops on the keyboard.

While extending the XLookupString facility to support more modifier keys
is fairly straight forward, it is not clear how one would support
_combinations_ of modifier keys.  This seems like a reasonable
use for the Keyboard and Modifier mapping tables, but I'm not sure what
type of indexing scheme should be used for the combinations.

I'm also interested in dealing with Lock keys other than Shift/Caps
Lock.  Particularly, the NumLock key on a PC/AT keyboard as well as
other locking modifier keys.  Caps Lock seems to be sort of hacked into
X without any provisions for other "locking" keys.

I know the Consortium has not yet defined anything in this area (see
Section 5 of the Protocol manual), but I would like to get and idea of 
the general trends.  I'm particulary interested in future extensions to 
the modifer map and XLookupString, as well as some of the solutions being 
used by other people.

Thanks in advance.


-- 
Mike Patnode					The Santa Cruz Operation 
SCO Software Engineer				400 Encinal Street
{ucscc,uunet}!sco!mikep	 mikep@sco.COM  	P.O. Box 1900
(408) 458-1422                                  Santa Cruz, CA 95061

erlkonig@walt.cc.utexas.edu (Christopher North-Keys) (04/12/90)

/----[mikep@sco.COM (Mike Patnode) The Santa Cruz Operation, Inc.]
| I'm also interested in dealing with Lock keys other than Shift/Caps
| Lock.  Particularly, the NumLock key on a PC/AT keyboard as well as
| other locking modifier keys.  Caps Lock seems to be sort of hacked into
| X without any provisions for other "locking" keys.

The solution looks clear to me --- code a "soft-lock" or "polylock" key the
applies to whichever set of modifiers is depressed when the softlock is
struck.  You could probably do this with a small X program;  I don't think
an extension would be necessary, but I not that deep in the source yet.

More specifically, if:

	{M==meta, S==shift, L==lock, [xX]==any char, ^==up, v==down},

then the sequence:

	XvX^ Sv LvL^ Sv XvX^ XvX^ Sv^ XvX^

should produce the output:

	xXXx

Also:

	Sv Lv^ S^ ...                shift-lock (caps) set
	Sv Lv^ S^ ... Sv^ ...        caps set, then unset
	Sv Mv Lv^ S^ M^ ... Mv^      caps and meta locked, then meta unlocked
	Lv^                          all soft-locks cleared

The implementation would need to track the shifted states for (say)
Meta, Control, Upper(case/numeric), Super, Hyper, Greek, etc.  Such a list
could validly be a dozen or more long, and should indicate:

state 0>  unset, awaiting shift-down
state 1>  set,   shift-down has been seen, but no shift-up yet.
state 2>  lock+, lock was seen while shift set, ignore next shift-up.
state 3>  lock,  lock and shift up seen, next shift-down triggers state 1.

The implementation could use a simple state transition table, and might be
best coded externally from the kernel.

Just thinking...


------------------------------------/\----------------------------------------
Seo:  Harp[@Mcc.Com]               /  \/\ ^*^           Christopher North-Keys
Tha mi gu trang a'cluich.         /    \ \         Assoc. Systems Analyst, MCC
--------------------------------(disclaimer)----------------------------------