libxkbcommon 1.13.0
Library implementing the XKB specification for parsing keyboard descriptions and handling keyboard state
Loading...
Searching...
No Matches
Public Member Functions
xkb_state Struct Reference

#include <xkbcommon.h>

Public Member Functions

XKB_EXPORT struct xkb_statexkb_state_new_with_mode (struct xkb_keymap *keymap, enum xkb_state_mode mode)
 
XKB_EXPORT struct xkb_statexkb_state_new (struct xkb_keymap *keymap)
 
XKB_EXPORT struct xkb_statexkb_state_ref (struct xkb_state *state)
 
XKB_EXPORT void xkb_state_unref (struct xkb_state *state)
 
XKB_EXPORT struct xkb_keymapxkb_state_get_keymap (struct xkb_state *state)
 
XKB_EXPORT enum xkb_state_component xkb_state_update_mask (struct xkb_state *state, xkb_mod_mask_t depressed_mods, xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods, xkb_layout_index_t depressed_layout, xkb_layout_index_t latched_layout, xkb_layout_index_t locked_layout)
 
XKB_EXPORT enum xkb_state_component xkb_state_update_event (struct xkb_state *state, const struct xkb_event *event)
 
XKB_EXPORT enum xkb_state_component xkb_state_update_key (struct xkb_state *state, xkb_keycode_t key, enum xkb_key_direction direction)
 
XKB_EXPORT enum xkb_error_code xkb_state_update_synthetic (struct xkb_state *state, const struct xkb_state_update *update, enum xkb_state_component *changed)
 
XKB_EXPORT enum xkb_state_component xkb_state_update_latched_locked (struct xkb_state *state, xkb_mod_mask_t affect_latched_mods, xkb_mod_mask_t latched_mods, bool affect_latched_layout, int32_t latched_layout, xkb_mod_mask_t affect_locked_mods, xkb_mod_mask_t locked_mods, bool affect_locked_layout, int32_t locked_layout)
 
XKB_EXPORT int xkb_state_key_get_syms (struct xkb_state *state, xkb_keycode_t key, const xkb_keysym_t **syms_out)
 
XKB_EXPORT int xkb_state_key_get_utf8 (struct xkb_state *state, xkb_keycode_t key, char *buffer, size_t size)
 
XKB_EXPORT uint32_t xkb_state_key_get_utf32 (struct xkb_state *state, xkb_keycode_t key)
 
XKB_EXPORT xkb_keysym_t xkb_state_key_get_one_sym (struct xkb_state *state, xkb_keycode_t key)
 
XKB_EXPORT xkb_layout_index_t xkb_state_key_get_layout (struct xkb_state *state, xkb_keycode_t key)
 
XKB_EXPORT xkb_level_index_t xkb_state_key_get_level (struct xkb_state *state, xkb_keycode_t key, xkb_layout_index_t layout)
 
XKB_EXPORT enum xkb_keyboard_control_flags xkb_state_serialize_enabled_controls (const struct xkb_state *state, enum xkb_state_component components)
 
XKB_EXPORT xkb_mod_mask_t xkb_state_serialize_mods (struct xkb_state *state, enum xkb_state_component components)
 
XKB_EXPORT xkb_layout_index_t xkb_state_serialize_layout (struct xkb_state *state, enum xkb_state_component components)
 
XKB_EXPORT int xkb_state_mod_name_is_active (struct xkb_state *state, const char *name, enum xkb_state_component type)
 
XKB_EXPORT int xkb_state_mod_names_are_active (struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match,...)
 
XKB_EXPORT int xkb_state_mod_index_is_active (struct xkb_state *state, xkb_mod_index_t idx, enum xkb_state_component type)
 
XKB_EXPORT int xkb_state_mod_indices_are_active (struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match,...)
 
XKB_EXPORT xkb_mod_mask_t xkb_state_key_get_consumed_mods2 (struct xkb_state *state, xkb_keycode_t key, enum xkb_consumed_mode mode)
 
XKB_EXPORT xkb_mod_mask_t xkb_state_key_get_consumed_mods (struct xkb_state *state, xkb_keycode_t key)
 
XKB_EXPORT int xkb_state_mod_index_is_consumed2 (struct xkb_state *state, xkb_keycode_t key, xkb_mod_index_t idx, enum xkb_consumed_mode mode)
 
XKB_EXPORT int xkb_state_mod_index_is_consumed (struct xkb_state *state, xkb_keycode_t key, xkb_mod_index_t idx)
 
XKB_EXPORT xkb_mod_mask_t xkb_state_mod_mask_remove_consumed (struct xkb_state *state, xkb_keycode_t key, xkb_mod_mask_t mask)
 
XKB_EXPORT int xkb_state_layout_name_is_active (struct xkb_state *state, const char *name, enum xkb_state_component type)
 
XKB_EXPORT int xkb_state_layout_index_is_active (struct xkb_state *state, xkb_layout_index_t idx, enum xkb_state_component type)
 
XKB_EXPORT int xkb_state_led_name_is_active (struct xkb_state *state, const char *name)
 
XKB_EXPORT int xkb_state_led_index_is_active (struct xkb_state *state, xkb_led_index_t idx)
 
XKB_EXPORT struct xkb_statexkb_x11_state_new_from_device (struct xkb_keymap *keymap, xcb_connection_t *connection, int32_t device_id)
 

Detailed Description

Opaque keyboard state object.

State objects contain the active state of a keyboard (or keyboards), such as the currently effective layout and the active modifiers. Depending on the use case, the state can be driven by raw key events or updated from server serializations, and always exposes a query API for keysyms, modifiers, layout and LEDs.

This object serves 3 roles:

Client API

Update the state from server serializations via xkb_state_update_mask(), then query it (keysyms, modifiers, layout, LEDs).

Use the constructor xkb_state_new_with_mode() with XKB_STATE_MODE_CLIENT.

See the examples in the quick guide.

Server query companion

Update via xkb_state_update_event() to expose the full query API alongside an `xkb_machine`: xkb_machine is the Mealy machine that processes keyboard input; xkb_state is its observable state, exposing the query API.

Use the constructor xkb_state_new_with_mode() with XKB_STATE_MODE_SERVER_QUERY.

See examples in the quick guide.

Legacy server API

xkb_state is a Mealy machine: it is a finite-state machine that takes a stream of raw key events – a pair ([keycode], [direction]) – as input, and produces xkb_state_component delta with the previous state. Output depends on both the input and the current internal state (active modifiers, current layout, etc.).

See Server State and Client State and xkb_state_mode for further details.


The documentation for this struct was generated from the following files: