KeyMapping.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Christian Jacobi, February 13, 1992 11:37 am PST
Christian Jacobi, February 19, 1992 9:47 am PST
Mapping between keycodes and keysyms.
DIRECTORY KeyMappingTypes, KeyTypes;
KeyMapping: CEDAR DEFINITIONS ~
BEGIN
KeySym: TYPE = KeyTypes.KeySym;
KeyCode: TYPE = KeyTypes.KeyCode;
Mapping: TYPE ~ KeyMappingTypes.Mapping;
KeySyms: TYPE ~ REF READONLY KeySymsRep;
KeySymsRep: TYPE ~ RECORD [SEQUENCE n: BYTE OF KeySym];
KeyTable: TYPE ~ REF KeyTableRep;
KeyTableRep: TYPE ~ ARRAY KeyCode OF REF KeySymsRep;
KeyCodes: TYPE ~ REF READONLY KeyCodesRep;
KeyCodesRep: TYPE ~ RECORD [SEQUENCE n: NAT OF KeyCodeIndexPair];
KeyCodeIndexPair: TYPE ~ PACKED RECORD [keyCode: KeyCode, glyphIndex: BYTE];
CountKeySyms: PROC [mapping: Mapping, keyCode: KeyCode] RETURNS [count: NAT];
Returns the number of glyphs on the key whose number is keyCode. If there is no key numbered keyCode, count will be 0.
GetKeySym: PROC [mapping: Mapping, keyCode: KeyCode, i: NAT] RETURNS [keySym: KeySym];
Returns the ith glyph on the key whose number is keyCode.
GetKeySyms: PROC [mapping: Mapping, keyCode: KeyCode] RETURNS [keySyms: KeySyms];
Returns the keysyms on the key whose number is keyCode.
May return empty sequence but never NIL.
KeyCodesFromKeySym: PROC [mapping: Mapping, keySym: KeySym] RETURNS [keyCodes: KeyCodes];
Inverse of GetKeySym.
May return empty sequence but never NIL.
WalkKeySymsProc: TYPE ~ PROC [keySym: KeySym] RETURNS [done: BOOL ¬ FALSE];
WalkKeySyms: PROC [mapping: Mapping, walkProc: WalkKeySymsProc] RETURNS [aborted: BOOL ¬ FALSE];
Find all of the KeySyms mentioned in mapping.
If the walkProc ever returns done=TRUE, WalkKeySyms will stop and return TRUE; otherwise it returns FALSE.
NewMapping: PROC [keyTable: KeyTable, maxCode: KeyCode ¬ KeyCode.LAST] RETURNS [mapping: Mapping];
Creates a mapping between keyCodes and keySyms. Client must not change keyTable data structures after they are passed in. maxCode is the highest valid KeyCode; providing this value allows some internal performance optimizations.
END.