libxkbcommon  0.2.0
Keymap Components

Enumeration of state components in a keymap. More...

Functions

xkb_mod_index_t xkb_keymap_num_mods (struct xkb_keymap *keymap)
 Get the number of modifiers in the keymap.
const char * xkb_keymap_mod_get_name (struct xkb_keymap *keymap, xkb_mod_index_t idx)
 Get the name of a modifier by index.
xkb_mod_index_t xkb_keymap_mod_get_index (struct xkb_keymap *keymap, const char *name)
 Get the index of a modifier by name.
xkb_layout_index_t xkb_keymap_num_layouts (struct xkb_keymap *keymap)
 Get the number of layouts in the keymap.
const char * xkb_keymap_layout_get_name (struct xkb_keymap *keymap, xkb_layout_index_t idx)
 Get the name of a layout by index.
xkb_layout_index_t xkb_keymap_layout_get_index (struct xkb_keymap *keymap, const char *name)
 Get the index of a layout by name.
xkb_layout_index_t xkb_keymap_num_layouts_for_key (struct xkb_keymap *keymap, xkb_keycode_t key)
 Get the number of layouts for a specific key.
xkb_level_index_t xkb_keymap_num_levels_for_key (struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout)
 Get the number of shift levels for a specific key and layout.
int xkb_keymap_key_get_syms_by_level (struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout, xkb_level_index_t level, const xkb_keysym_t **syms_out)
 Get the keysyms obtained from pressing a key in a given layout and shift level.
xkb_led_index_t xkb_keymap_num_leds (struct xkb_keymap *keymap)
 Get the number of LEDs in the keymap.
const char * xkb_keymap_led_get_name (struct xkb_keymap *keymap, xkb_led_index_t idx)
 Get the name of a LED by index.
xkb_led_index_t xkb_keymap_led_get_index (struct xkb_keymap *keymap, const char *name)
 Get the index of a LED by name.
int xkb_keymap_key_repeats (struct xkb_keymap *keymap, xkb_keycode_t key)
 Determine whether a key should repeat or not.

Detailed Description

Enumeration of state components in a keymap.

Function Documentation

xkb_mod_index_t xkb_keymap_num_mods ( struct xkb_keymap keymap)

Get the number of modifiers in the keymap.

See Also
xkb_mod_index_t
const char * xkb_keymap_mod_get_name ( struct xkb_keymap keymap,
xkb_mod_index_t  idx 
)

Get the name of a modifier by index.

Returns
The name. If the index is invalid, returns NULL.
See Also
xkb_mod_index_t
xkb_mod_index_t xkb_keymap_mod_get_index ( struct xkb_keymap keymap,
const char *  name 
)

Get the index of a modifier by name.

Returns
The index. If no modifier with this name exists, returns XKB_MOD_INVALID.
See Also
xkb_mod_index_t
xkb_layout_index_t xkb_keymap_num_layouts ( struct xkb_keymap keymap)

Get the number of layouts in the keymap.

See Also
xkb_layout_index_t xkb_rule_names xkb_keymap_num_layouts_for_key()
const char * xkb_keymap_layout_get_name ( struct xkb_keymap keymap,
xkb_layout_index_t  idx 
)

Get the name of a layout by index.

Returns
The name. If the index is invalid, or the layout does not have a name, returns NULL.
See Also
xkb_layout_index_t
xkb_layout_index_t xkb_keymap_layout_get_index ( struct xkb_keymap keymap,
const char *  name 
)

Get the index of a layout by name.

Returns
The index. If no layout exists with this name, returns XKB_LAYOUT_INVALID. If more than one layout in the keymap has this name, returns the lowest index among them.
xkb_layout_index_t xkb_keymap_num_layouts_for_key ( struct xkb_keymap keymap,
xkb_keycode_t  key 
)

Get the number of layouts for a specific key.

This number can be different from xkb_keymap_num_layouts(), but is always smaller. It is the appropriate value to use when iterating over the layouts of a key.

See Also
xkb_layout_index_t
xkb_level_index_t xkb_keymap_num_levels_for_key ( struct xkb_keymap keymap,
xkb_keycode_t  key,
xkb_layout_index_t  layout 
)

Get the number of shift levels for a specific key and layout.

See Also
xkb_level_index_t
int xkb_keymap_key_get_syms_by_level ( struct xkb_keymap keymap,
xkb_keycode_t  key,
xkb_layout_index_t  layout,
xkb_level_index_t  level,
const xkb_keysym_t **  syms_out 
)

Get the keysyms obtained from pressing a key in a given layout and shift level.

This function is like xkb_state_key_get_syms(), only the layout and shift level are not derived from the keyboard state but are instead specified explicitly.

Parameters
[in]keymapThe keymap.
[in]keyThe keycode of the key.
[in]layoutThe layout for which to get the keysyms. This must be smaller than: Usually it would be:
xkb_state_key_get_layout(state, key)
[in]levelThe shift level in the layout for which to get the keysyms. This must be smaller than: usually it would be:
xkb_state_key_get_level(state, key, layout)
[out]syms_outAn immutible array of keysyms corresponding the key in the given layout and shift level.
Returns
The number of keysyms in the syms_out array. If no keysyms are produced by the key in the given layout and shift level, returns 0 and sets syms_out to NULL.
See Also
xkb_state_key_get_syms()
xkb_led_index_t xkb_keymap_num_leds ( struct xkb_keymap keymap)

Get the number of LEDs in the keymap.

Warning
The range [ 0...xkb_keymap_num_leds() ) includes all of the LEDs in the keymap, but may also contain inactive LEDs. When iterating over this range, you need the handle this case when calling functions such as xkb_keymap_led_get_name() or xkb_state_led_index_is_active().
See Also
xkb_led_index_t
const char * xkb_keymap_led_get_name ( struct xkb_keymap keymap,
xkb_led_index_t  idx 
)

Get the name of a LED by index.

Returns
The name. If the index is invalid, returns NULL.
xkb_led_index_t xkb_keymap_led_get_index ( struct xkb_keymap keymap,
const char *  name 
)

Get the index of a LED by name.

Returns
The index. If no LED with this name exists, returns XKB_LED_INVALID.
int xkb_keymap_key_repeats ( struct xkb_keymap keymap,
xkb_keycode_t  key 
)

Determine whether a key should repeat or not.

A keymap may specify different repeat behaviors for different keys. Most keys should generally exhibit repeat behavior; for example, holding the 'a' key down in a text editor should normally insert a single 'a' character every few milliseconds, until the key is released. However, there are keys which should not or do not need to be repeated. For example, repeating modifier keys such as Left/Right Shift or Caps Lock is not generally useful or desired.

Returns
1 if the key should repeat, 0 otherwise.