Table of Contents


XkbKeyTypesForCoreSymbols - Determine the Xkb key types appropriate for the symbols bound to a key in a core keyboard mapping


int XkbKeyTypesForCoreSymbols
(XkbDescPtr xkb, int map_width, KeySym *core_syms, unsigned int protected, int *types_inout, KeySym *xkb_syms_rtrn);


- xkb
keyboard description in which to place symbols
- map_width
width of core protocol keymap in xkb_syms_rtrn
- core_syms
core protocol format array of KeySyms
- protected
explicit key types
- types_inout
backfilled with the canonical types bound to groups one and two for the key
- xkb_syms_rtrn
backfilled with symbols bound to the key in the Xkb mapping


XkbKeyTypesForCoreSymbols expands the symbols in core_syms and types in types_inout, then chooses canonical key types (canonical key types are defined The Canonical Key Types) for groups 1 and 2 using the rules specified by the Xkb protocol and places them in xkb_syms_rtrn, which will be non-NULL.

The Canonical

Key Types

Xkb allows up to XkbMaxKeyTypes (255) key types to be defined, but requires at least XkbNumRequiredTypes (4) predefined types to be in a key map. These predefined key types are referred to as the canonical key types and describe the types of keys available on most keyboards. The definitions for the canonical key types are held in the first XkbNumRequiredTypes entries of the types field of the client map and are indexed using the following constants:



The ONE_LEVEL key type describes groups that have only one symbol. The default ONE_LEVEL key type has no map entries and does not pay attention to any modifiers. A symbolic representation of this key type could look like the following:

    type "ONE_LEVEL" {
         modifiers = None;
         map[None]= Level1;
         level_name[Level1]= "Any";
The description of the ONE_LEVEL key type is stored in the types[XkbOneLevelIndex] entry of the client key map.


The TWO_LEVEL key type describes groups that consist of two symbols but are neither alphabetic nor numeric keypad keys. The default TWO_LEVEL type uses only the Shift modifier. It returns shift level two if Shift is set, and level one if it is not. A symbolic representation of this key type could look like the following:

    type "TWO_LEVEL" {
        modifiers = Shift;
        map[Shift]= Level2;
        level_name[Level1]= "Base";
        level_name[Level2]= "Shift";

The description of the TWO_LEVEL key type is stored in the types[XkbTwoLevelIndex] entry of the client key map.


The ALPHABETIC key type describes groups consisting of two symbols: the lowercase form of a symbol followed by the uppercase form of the same symbol. The default ALPHABETIC type implements locale-sensitive "Shift cancels CapsLock" behavior using both the Shift and Lock modifiers as follows:

Table of Contents