|
The xkb_compat type files.This file contents describes modifier keys behavior. Or in the other words how keyboard state changes when you press such keys. I should remind that the XKB module has internal tables named Xkb Compability Map. This data consists of two parts:
An application can request X-server to change symbol to keycode binding. If the symbol is ordinar "printable" symbol there is no problem. But if it is "control" symbol that imply change of modifier, group number or XKB internal state the XKB module has to bind an "action" to corresponded place in keycode bound table. But "old standard" request has no information about "action" so XKB has to decide what action must be bound using own data. The xkb_compat type files can contain records:
Virtual modifier declaration.As in xkb_types type files a virtual modifiers that can be used in followed inctructions must be declared here. A real modifiers that can be used doesn't need to be declared becouse they have standard names. But the virtual modifiers can have any names therefore parser program need to know these names before all other instruction will be parsed. Virtual modifier declaration looks like: 'virtual_modifiers' modifiers list ';' For example:virtual_modifiers NumLock, AltGr ; Interpretation description.Each interpretation defines relation between some control symbol code and an action that the XKB has to perform at key pressing. Internal structure that describes interpretation consists of fields
Of course, not all fields need to be filled. The main fields are "symbol code" that defines symbol to which action has to be bound and "action" field that describes this action itself. Also interpretation can contain filled "real modifiers" and "match condition" fields. What these two fields are used for? If these two fields isn't specified the XKB places action to the same key (to the same cell) where control symbol will be placed to. But if these fields aren't empty the XKB before action placing compares modifier bound to keycode with "real modifiers set" specified in interpretation. The "match condition" defines how modifiers has to be compared (details see below). By the way, if these two fields are specified the interpretation can have not "symbol code". It means that the XKB can find place for action using compare result only. For example, interpretation can mean - "place the action to keycode that has Lock modifier bound independently on what symbol is bound to that keycode". So.. The "real modifiers" field is one or more modifiers.
Of course, by default the "real modifiers" field is empty and "match condition" is AnyOfOrNone. The fields "flags" and "virtual modifier" also can be moved into keycode description. Since such fields are common for whole keycode description (not for particular symbol cell) the interpretation that binds these fields to keycode usualy contain LevelOneOnly condition. Flags will be added to "key behavior" and "virtual modifier" will be placed to "firtual modifiers" field of keycode description (each keycode has these fields). By default "virtual modifier" field is empty and "flags" field contains "autorepeat" flag. Thus, the interpretation whole description looks like: 'interpret' symbol '{' description '};' or'interpret' symbol '+' modifier '{' description '};' or'interpret' symbol '+' condition '(' modifiers ') {' description '};' For example:interpret Num_Lock {...}; interpret ISO_Level2 + Shift {...}; interpret ISO_Lock + AnyOf(Lock+shift) {...};
Instructions inside interpretation description looks like assignment instruction:
useModMapModsIs used for specifying LevelOneOnly condition. If a word in right side is "level1" or "levelone" the condition has to be checked. But words "anylevel" or "any" means that the condition has to be ignored. By the way, by default this condition has to be ignored, so lines like useModMapMods = anylevel; doesn't make sense.repeat and locking These instruction are used for specifying "autorepeat" and "locking" flags. The word in right side must be name of logical value - True or False. repeat = True; locking = False; virtualModifierThis instruction defines a virtual modifier for keycode. Since such modifier is attribute of keycode (not of particular symbol), the interpretation with virtualModifier usualy uses LevelOneOnly condition. A word in right side is name of any virtual modifier. virtualModifier = AltGr; action This instruction describes an action. More details about format of action description you can read in Actions description. interpret ... { repeat = False; locking = True; action = NoAction(); }; Group number to modifier mapping.I should remind that group number occupates two bit field in XKB internal state and in key event meassage. But old application know nothing about XKB groups and this two bit field in event. Such application decides that group (remind that old keyboard module has two "group" too) is changed using one of modifier. Therefore for such application the XKB needs to map group number value to some modifier state. For each value (from one to four) separate mpodifier can be used. (But usualy for all groups except first one modifier is used.) This declaration looks simply: 'group' group number '=' modifier ';' For example:group 2 = AltGr; Indicator behavior description.Although indicators behavior has no relation to compability map, they also are described in xkb_compat type files. I should remind that the XKB can manage up to 32 indicators. The first 3-4 ones (in dependence on hardware type) match to real LEDs on keyboard. All other indicators are "virtual" and can be showed by spaecial programs. In xkb_keycodes type file the a symbolic names are assigned to each used indicator (specified by number). And xkb_compat type file describes how these indicators behave in dependence on keyboard state. Remind that ...
I should note that one modifier can reflect simultaneously changes of some modifier and a group number and a control flag. (Don't ask me what it can be needed for :-). And the second point is that the indicator also can be switched by application. Thus describing indicator we can allow/deny such "external" switching and describe "feedback" (it means that when program changes indicator state the reflected "state components" also has to be changed). The indicator behavior whole description looks like: 'indicator' inducator_name '{' description '};' Here indicator_name is symbolic name (in double quotas) assigned to the indicator in xkb_keycodes type file. And description consists of instructions that looks like assignment instruction. They can be one of:
modifiers, groups Й controls These ones define what "state components" the indicator has to reflect.
Note that the group number can be specified ...
whichModState and whichGroupStateSince modifiers set and group number are distributed to three separate variable (base, locked, latched) these instructions are needed to specify which variable state must be reflected by indicator. The word in the left part can be
allowExplicitIt is logical flag that allow/disallow applications switch on/off indicator. The point is that any application (for example, xset with led option) can send request to change state of indicator. And this flag is used for set/unset the indicator protection against such changes. Note that even if allowed such request changes indicator state only but XKB state (group, modifier, control flag reflected by this indicator) will stay unchanged. Since this allowExplicit is boolean flag it can be specified in form allowExplicit = True; or allowExplicit = False; or in short formallowExplicit; (is equivalent to 'allowExplicit = True;' ) or!allowExplicit; (is equivalent to 'allowExplicit = False;') By default its value is True. It means that all application is allowed to change indicators. drivesKeyboardIt has many synonyms - drivesKbd, ledDrivesKbd, ledDrivesKkeyboard, indicatorDrivesKbd, indicatorDrivesKeyboard. It is also boolean flag that force the XKB to make 'feedback' between indicator and keyboard state. It means that if this flag is set (and allowExplicit too) and an application changes indicator state the XKB has to change own state components related to this indicator. Note that
Herewith if "which...state" is none, base or any it will not have any effect. And effective in this case is equivalent to locked. Remind that by default "which...state" value is effective so if "which...state" isn't specified for the indicator all changes will be made in locked Group or locked Modifiers variable respectively. As for allowExplicit flag the drivesKeyboard declaration looks like drivesKeyboard = True; (or simply - drivesKeyboard;) ordrivesKeyboard = False; (or simply - !drivesKeyboard;) indexThis instruction allow to specify number of indicator (physical or virtual one). Normally a relation between indicator name and its number is set up in the xkb_keycodes type file. But you can specify it here. Defaults declaration.This declaration is optional and allow specify some field (instruction) for all next record such as interpret or indicator. Usualy such declaration are placed at the begin of file or begin of separate section. The looks like assignment where left side looks like 'field of structure' in C language. indicator.allowExplicit = False; means that in all next indicator descriptions the allowExplicit flag imply False value (of course, if such instruction isn't specified explicitly in the description).The first word in left side (before period sign) must be
|