89 #include <xkbcommon/xkbcommon-keysyms.h>
285 #define XKB_KEYCODE_INVALID (0xffffffff)
286 #define XKB_LAYOUT_INVALID (0xffffffff)
287 #define XKB_LEVEL_INVALID (0xffffffff)
288 #define XKB_MOD_INVALID (0xffffffff)
289 #define XKB_LED_INVALID (0xffffffff)
291 #define XKB_KEYCODE_MAX (0xffffffff - 1)
297 #define xkb_keycode_is_legal_ext(key) (key <= XKB_KEYCODE_MAX)
303 #define xkb_keycode_is_legal_x11(key) (key >= 8 && key <= 255)
670 const char *format, va_list args));
796 #define XKB_KEYMAP_USE_ORIGINAL_FORMAT ((enum xkb_keymap_format) -1)
959 xkb_layout_index_t layout);
992 xkb_layout_index_t layout,
993 xkb_level_index_t level,
994 const xkb_keysym_t **syms_out);
1202 xkb_mod_mask_t depressed_mods,
1203 xkb_mod_mask_t latched_mods,
1204 xkb_mod_mask_t locked_mods,
1205 xkb_layout_index_t depressed_layout,
1206 xkb_layout_index_t latched_layout,
1207 xkb_layout_index_t locked_layout);
1235 const xkb_keysym_t **syms_out);
1296 xkb_layout_index_t layout);
1492 xkb_mod_index_t idx);
1505 xkb_mod_mask_t mask);
1534 xkb_layout_index_t idx,
1564 #include <xkbcommon/xkbcommon-compat.h>
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.
void xkb_context_set_log_verbosity(struct xkb_context *context, int verbosity)
Sets the current logging verbosity.
Effective modifiers, i.e.
Definition: xkbcommon.h:1130
struct xkb_keymap * xkb_state_get_keymap(struct xkb_state *state)
Get the keymap which a keyboard state object is using.
struct xkb_keymap * xkb_keymap_ref(struct xkb_keymap *keymap)
Take a new reference on a keymap.
Log warnings and errors.
Definition: xkbcommon.h:586
The key was pressed.
Definition: xkbcommon.h:1108
Predefined names for common modifiers and LEDs.
int xkb_context_include_path_reset_defaults(struct xkb_context *context)
Reset the context's include path to the default.
struct xkb_context * xkb_context_new(enum xkb_context_flags flags)
Create a new context.
xkb_level_index_t xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t key, xkb_layout_index_t layout)
Get the effective shift level for a key in a given keyboard state and layout.
enum xkb_state_component xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key, enum xkb_key_direction direction)
Update the keyboard state to reflect a given key being pressed or released.
int xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size)
Get the Unicode/UTF-8 representation of a keysym.
xkb_state_component
Modifier and layout types for state objects.
Definition: xkbcommon.h:1118
Log information, warnings, and errors.
Definition: xkbcommon.h:587
Makes matching non-exclusive, i.e.
Definition: xkbcommon.h:1311
Opaque top level library context object.
uint32_t xkb_keysym_to_utf32(xkb_keysym_t keysym)
Get the Unicode/UTF-32 representation of a keysym.
Locked modifiers, i.e.
Definition: xkbcommon.h:1126
Depressed layout, i.e.
Definition: xkbcommon.h:1132
int xkb_state_layout_name_is_active(struct xkb_state *state, const char *name, enum xkb_state_component type)
Test whether a layout is active in a given keyboard state 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.
int xkb_keysym_get_name(xkb_keysym_t keysym, char *buffer, size_t size)
Get the name of a keysym.
Latched modifiers, i.e.
Definition: xkbcommon.h:1123
Returns true if all of the modifiers are active.
Definition: xkbcommon.h:1308
struct xkb_state * xkb_state_new(struct xkb_keymap *keymap)
Create a new keyboard state object.
The current/classic XKB text format, as generated by xkbcomp -xkb.
Definition: xkbcommon.h:718
Create this context with an empty include path.
Definition: xkbcommon.h:433
int xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx, enum xkb_state_component type)
Test whether a modifier is active in a given keyboard state by index.
struct xkb_keymap * xkb_keymap_new_from_string(struct xkb_context *context, const char *string, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
Create a keymap from a keymap string.
xkb_layout_index_t xkb_keymap_num_layouts(struct xkb_keymap *keymap)
Get the number of layouts in the keymap.
int xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key, const xkb_keysym_t **syms_out)
Get the keysyms obtained from pressing a particular key in a given keyboard state.
Latched layout, i.e.
Definition: xkbcommon.h:1135
void xkb_context_set_user_data(struct xkb_context *context, void *user_data)
Store custom user data in the context.
Do not apply any flags.
Definition: xkbcommon.h:684
xkb_led_index_t xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name)
Get the index of a LED by name.
Log everything.
Definition: xkbcommon.h:588
char * xkb_keymap_get_as_string(struct xkb_keymap *keymap, enum xkb_keymap_format format)
Get the compiled keymap as a string.
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().
Definition: xkbcommon.h:854
xkb_mod_mask_t xkb_state_serialize_mods(struct xkb_state *state, enum xkb_state_component components)
The counterpart to xkb_state_update_mask for modifiers, to be used on the server side of serializatio...
Do not apply any context flags.
Definition: xkbcommon.h:431
const char * xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx)
Get the name of a layout by index.
struct xkb_state * xkb_state_ref(struct xkb_state *state)
Take a new reference on a keyboard state object.
xkb_log_level
Specifies a logging level.
Definition: xkbcommon.h:583
int xkb_state_led_name_is_active(struct xkb_state *state, const char *name)
Test whether a LED is active in a given keyboard state by name.
LEDs (derived from the other state components).
Definition: xkbcommon.h:1144
int xkb_context_get_log_verbosity(struct xkb_context *context)
Get the current logging verbosity of the context.
void xkb_context_set_log_level(struct xkb_context *context, enum xkb_log_level level)
Set the current logging level.
Apparently you can't have empty enums.
Definition: xkbcommon.h:686
uint32_t xkb_led_mask_t
A mask of LED indices.
Definition: xkbcommon.h:283
struct xkb_context * xkb_context_ref(struct xkb_context *context)
Take a new reference on a context.
xkb_keymap_compile_flags
Flags for keymap compilation.
Definition: xkbcommon.h:682
Effective layout, i.e.
Definition: xkbcommon.h:1142
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_led_index_t xkb_keymap_num_leds(struct xkb_keymap *keymap)
Get the number of LEDs in the keymap.
uint32_t xkb_led_index_t
Index of a keyboard LED.
Definition: xkbcommon.h:281
void xkb_context_include_path_clear(struct xkb_context *context)
Remove all entries from the context's include path.
void xkb_context_set_log_fn(struct xkb_context *context, void(*log_fn)(struct xkb_context *context, enum xkb_log_level level, const char *format, va_list args))
Set a custom function to handle logging messages.
int xkb_context_include_path_append(struct xkb_context *context, const char *path)
Append a new entry to the context's include path.
xkb_keysym_t xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t key)
Get the single keysym obtained from pressing a particular key in a given keyboard state...
void xkb_state_unref(struct xkb_state *state)
Release a reference on a keybaord state object, and possibly free it.
int xkb_state_mod_name_is_active(struct xkb_state *state, const char *name, enum xkb_state_component type)
Test whether a modifier is active in a given keyboard state by name.
xkb_layout_index_t xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t key)
Get the effective layout index for a key in a given keyboard state.
const char * variant
A comma separated list of variants, one per layout, which may modify or augment the respective layout...
Definition: xkbcommon.h:324
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_mod_mask_t xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key, xkb_mod_mask_t mask)
Remove consumed modifiers from a modifier mask for a key.
xkb_layout_index_t xkb_state_serialize_layout(struct xkb_state *state, enum xkb_state_component components)
The counterpart to xkb_state_update_mask for layouts, to be used on the server side of serialization...
int xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key, xkb_mod_index_t idx)
Test whether a modifier is consumed by keyboard state translation for a key.
struct xkb_keymap * xkb_keymap_new_from_buffer(struct xkb_context *context, const char *buffer, size_t length, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
Create a keymap from a memory buffer.
void xkb_keymap_unref(struct xkb_keymap *keymap)
Release a reference on a keymap, and possibly free it.
uint32_t xkb_mod_mask_t
A mask of modifier indices.
Definition: xkbcommon.h:254
xkb_keycode_t xkb_keymap_min_keycode(struct xkb_keymap *keymap)
Get the minimum keycode in the keymap.
xkb_keysym_t xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags)
Get a keysym from its name.
xkb_layout_index_t xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name)
Get the index of a layout by name.
int xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx)
Test whether a LED is active in a given keyboard state by index.
The key was released.
Definition: xkbcommon.h:1107
xkb_keycode_t xkb_keymap_max_keycode(struct xkb_keymap *keymap)
Get the maximum keycode in the keymap.
void xkb_context_unref(struct xkb_context *context)
Release a reference on a context, and possibly free it.
int xkb_state_mod_indices_are_active(struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match,...)
Test whether a set of modifiers are active in a given keyboard state by index.
Depressed modifiers, i.e.
Definition: xkbcommon.h:1120
int xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key)
Determine whether a key should repeat or not.
uint32_t xkb_keycode_t
A number used to represent a physical key on a keyboard.
Definition: xkbcommon.h:134
struct xkb_keymap * xkb_keymap_new_from_file(struct xkb_context *context, FILE *file, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags)
Create a keymap from a keymap file.
xkb_key_direction
Specifies the direction of the key (press / release).
Definition: xkbcommon.h:1106
xkb_mod_index_t xkb_keymap_num_mods(struct xkb_keymap *keymap)
Get the number of modifiers in the keymap.
Find keysym by case-insensitive search.
Definition: xkbcommon.h:366
struct xkb_keymap * xkb_keymap_new_from_names(struct xkb_context *context, const struct xkb_rule_names *names, enum xkb_keymap_compile_flags flags)
Create a keymap from RMLVO names.
const char * model
The keyboard model by which to interpret keycodes and LEDs.
Definition: xkbcommon.h:318
uint32_t xkb_layout_index_t
Index of a keyboard layout.
Definition: xkbcommon.h:211
Don't take RMLVO names from the environment.
Definition: xkbcommon.h:435
const char * options
A comma separated list of options, through which the user specifies non-layout related preferences...
Definition: xkbcommon.h:328
Do not apply any flags.
Definition: xkbcommon.h:364
Returns true if any of the modifiers are active.
Definition: xkbcommon.h:1306
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.
const char * xkb_context_include_path_get(struct xkb_context *context, unsigned int index)
Get a specific include path from the context's include path.
uint32_t xkb_keysym_t
A number used to represent the symbols generated from a key on a keyboard.
Definition: xkbcommon.h:191
xkb_context_flags
Flags for context creation.
Definition: xkbcommon.h:429
const char * rules
The rules file to use.
Definition: xkbcommon.h:316
uint32_t xkb_level_index_t
Index of a shift level.
Definition: xkbcommon.h:227
Locked layout, i.e.
Definition: xkbcommon.h:1138
uint32_t xkb_mod_index_t
Index of a modifier.
Definition: xkbcommon.h:252
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.
void * xkb_context_get_user_data(struct xkb_context *context)
Retrieves stored user data from the context.
enum xkb_log_level xkb_context_get_log_level(struct xkb_context *context)
Get the current logging level.
Opaque keyboard state object.
Definition: xkbcommon.h:123
Opaque compiled keymap object.
Definition: xkbcommon.h:111
Names to compile a keymap with, also known as RMLVO.
Definition: xkbcommon.h:313
const char * layout
A comma separated list of layouts (languages) to include in the keymap.
Definition: xkbcommon.h:321
unsigned int xkb_context_num_include_paths(struct xkb_context *context)
Get the number of paths in the context's include path.
int xkb_state_mod_names_are_active(struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match,...)
Test whether a set of modifiers are active in a given keyboard state by name.
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)
Update a keyboard state from a set of explicit masks.
xkb_keysym_flags
Flags for xkb_keysym_from_name().
Definition: xkbcommon.h:362
int xkb_state_layout_index_is_active(struct xkb_state *state, xkb_layout_index_t idx, enum xkb_state_component type)
Test whether a layout is active in a given keyboard state by index.
xkb_keymap_format
The possible keymap formats.
Definition: xkbcommon.h:716
xkb_state_match
Match flags for xkb_state_mod_indices_are_active and xkb_state_mod_names_are_active, specifying how the conditions for a successful match.
Definition: xkbcommon.h:1304
Log critical internal errors only.
Definition: xkbcommon.h:584
int xkb_context_include_path_append_default(struct xkb_context *context)
Append the default include paths to the context's include path.
Log all errors.
Definition: xkbcommon.h:585
xkb_mod_index_t xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name)
Get the index of a modifier by name.
uint32_t xkb_layout_mask_t
A mask of layout indices.
Definition: xkbcommon.h:213