libxkbcommon 1.7.0
Typedefs | Functions
Keymap Components

Typedefs

typedef void(* xkb_keymap::xkb_keymap_key_iter_t) (struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
 

Functions

xkb_keycode_t xkb_keymap::xkb_keymap_min_keycode (struct xkb_keymap *keymap)
 
xkb_keycode_t xkb_keymap::xkb_keymap_max_keycode (struct xkb_keymap *keymap)
 
void xkb_keymap::xkb_keymap_key_for_each (struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, void *data)
 
const char * xkb_keymap::xkb_keymap_key_get_name (struct xkb_keymap *keymap, xkb_keycode_t key)
 
xkb_keycode_t xkb_keymap::xkb_keymap_key_by_name (struct xkb_keymap *keymap, const char *name)
 
xkb_mod_index_t xkb_keymap::xkb_keymap_num_mods (struct xkb_keymap *keymap)
 
const char * xkb_keymap::xkb_keymap_mod_get_name (struct xkb_keymap *keymap, xkb_mod_index_t idx)
 
xkb_mod_index_t xkb_keymap::xkb_keymap_mod_get_index (struct xkb_keymap *keymap, const char *name)
 
xkb_layout_index_t xkb_keymap::xkb_keymap_num_layouts (struct xkb_keymap *keymap)
 
const char * xkb_keymap::xkb_keymap_layout_get_name (struct xkb_keymap *keymap, xkb_layout_index_t idx)
 
xkb_layout_index_t xkb_keymap::xkb_keymap_layout_get_index (struct xkb_keymap *keymap, const char *name)
 
xkb_led_index_t xkb_keymap::xkb_keymap_num_leds (struct xkb_keymap *keymap)
 
const char * xkb_keymap::xkb_keymap_led_get_name (struct xkb_keymap *keymap, xkb_led_index_t idx)
 
xkb_led_index_t xkb_keymap::xkb_keymap_led_get_index (struct xkb_keymap *keymap, const char *name)
 
xkb_layout_index_t xkb_keymap::xkb_keymap_num_layouts_for_key (struct xkb_keymap *keymap, xkb_keycode_t key)
 
xkb_level_index_t xkb_keymap::xkb_keymap_num_levels_for_key (struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout)
 
size_t xkb_keymap::xkb_keymap_key_get_mods_for_level (struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout, xkb_level_index_t level, xkb_mod_mask_t *masks_out, size_t masks_size)
 
int xkb_keymap::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)
 
int xkb_keymap::xkb_keymap_key_repeats (struct xkb_keymap *keymap, xkb_keycode_t key)
 

Detailed Description

Enumeration of state components in a keymap.

Typedef Documentation

◆ xkb_keymap_key_iter_t

typedef void(* xkb_keymap_key_iter_t) (struct xkb_keymap *keymap, xkb_keycode_t key, void *data)

The iterator used by xkb_keymap_key_for_each().

See also
xkb_keymap_key_for_each
Since
0.3.1

Function Documentation

◆ xkb_keymap_min_keycode()

xkb_keycode_t xkb_keymap_min_keycode ( struct xkb_keymap * keymap)

Get the minimum keycode in the keymap.

See also
xkb_keycode_t
Since
0.3.1

◆ xkb_keymap_max_keycode()

xkb_keycode_t xkb_keymap_max_keycode ( struct xkb_keymap * keymap)

Get the maximum keycode in the keymap.

See also
xkb_keycode_t
Since
0.3.1

◆ xkb_keymap_key_for_each()

void xkb_keymap_key_for_each ( struct xkb_keymap * keymap,
xkb_keymap_key_iter_t iter,
void * data )

Run a specified function for every valid keycode in the keymap.

If a keymap is sparse, this function may be called fewer than (max_keycode - min_keycode + 1) times.

See also
xkb_keymap_min_keycode() xkb_keymap_max_keycode() xkb_keycode_t
Since
0.3.1

◆ xkb_keymap_key_get_name()

const char * xkb_keymap_key_get_name ( struct xkb_keymap * keymap,
xkb_keycode_t key )

Find the name of the key with the given keycode.

This function always returns the canonical name of the key (see description in xkb_keycode_t).

Returns
The key name. If no key with this keycode exists, returns NULL.
See also
xkb_keycode_t
Since
0.6.0

◆ xkb_keymap_key_by_name()

xkb_keycode_t xkb_keymap_key_by_name ( struct xkb_keymap * keymap,
const char * name )

Find the keycode of the key with the given name.

The name can be either a canonical name or an alias.

Returns
The keycode. If no key with this name exists, returns XKB_KEYCODE_INVALID.
See also
xkb_keycode_t
Since
0.6.0

◆ xkb_keymap_num_mods()

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

◆ xkb_keymap_mod_get_name()

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_keymap_mod_get_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.

Returns
The index. If no modifier with this name exists, returns XKB_MOD_INVALID.
See also
xkb_mod_index_t

◆ xkb_keymap_num_layouts()

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()

◆ xkb_keymap_layout_get_name()

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 For notes on layout names.

◆ xkb_keymap_layout_get_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.

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.
See also
xkb_layout_index_t For notes on layout names.

◆ xkb_keymap_num_leds()

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

◆ xkb_keymap_led_get_name()

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_keymap_led_get_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.

Returns
The index. If no LED with this name exists, returns XKB_LED_INVALID.

◆ xkb_keymap_num_layouts_for_key()

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_keymap_num_levels_for_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.

If layout is out of range for this key (that is, larger or equal to the value returned by xkb_keymap_num_layouts_for_key()), it is brought back into range in a manner consistent with xkb_state_key_get_layout().

See also
xkb_level_index_t

◆ xkb_keymap_key_get_mods_for_level()

size_t xkb_keymap_key_get_mods_for_level ( struct xkb_keymap * keymap,
xkb_keycode_t key,
xkb_layout_index_t layout,
xkb_level_index_t level,
xkb_mod_mask_t * masks_out,
size_t masks_size )

Retrieves every possible modifier mask that produces the specified shift level for a specific key and layout.

This API is useful for inverse key transformation; i.e. finding out which modifiers need to be active in order to be able to type the keysym(s) corresponding to the specific key code, layout and level.

Warning
It returns only up to masks_size modifier masks. If the buffer passed is too small, some of the possible modifier combinations will not be returned.
Parameters
[in]keymapThe keymap.
[in]keyThe keycode of the key.
[in]layoutThe layout for which to get modifiers.
[in]levelThe shift level in the layout for which to get the modifiers. This should be smaller than:
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.
[out]masks_outA buffer in which the requested masks should be stored.
[out]masks_sizeThe number of elements in the buffer pointed to by masks_out.

If layout is out of range for this key (that is, larger or equal to the value returned by xkb_keymap_num_layouts_for_key()), it is brought back into range in a manner consistent with xkb_state_key_get_layout().

Returns
The number of modifier masks stored in the masks_out array. If the key is not in the keymap or if the specified shift level cannot be reached it returns 0 and does not modify the masks_out buffer.
See also
xkb_level_index_t
xkb_mod_mask_t
Since
1.0.0

◆ xkb_keymap_key_get_syms_by_level()

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.
[in]levelThe shift level in the layout for which to get the keysyms. This should be smaller than:
[out]syms_outAn immutable array of keysyms corresponding to the key in the given layout and shift level.

If layout is out of range for this key (that is, larger or equal to the value returned by xkb_keymap_num_layouts_for_key()), it is brought back into range in a manner consistent with xkb_state_key_get_layout().

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_keymap_key_repeats()

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.