libxkbcommon 0.4.0

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

xkbcommon.h
Go to the documentation of this file.
1 /*
2 * Copyright 1985, 1987, 1990, 1998 The Open Group
3 * Copyright 2008 Dan Nicholson
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Except as contained in this notice, the names of the authors or their
23 * institutions shall not be used in advertising or otherwise to promote the
24 * sale, use or other dealings in this Software without prior written
25 * authorization from the authors.
26 */
27
28 /************************************************************
29 * Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
30 *
31 * Permission to use, copy, modify, and distribute this
32 * software and its documentation for any purpose and without
33 * fee is hereby granted, provided that the above copyright
34 * notice appear in all copies and that both that copyright
35 * notice and this permission notice appear in supporting
36 * documentation, and that the name of Silicon Graphics not be
37 * used in advertising or publicity pertaining to distribution
38 * of the software without specific prior written permission.
39 * Silicon Graphics makes no representation about the suitability
40 * of this software for any purpose. It is provided "as is"
41 * without any express or implied warranty.
42 *
43 * SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
44 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
46 * GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
47 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
48 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
49 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
50 * THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 *
52 ********************************************************/
53
54 /*
55 * Copyright © 2009-2012 Daniel Stone
56 * Copyright © 2012 Intel Corporation
57 * Copyright © 2012 Ran Benita
58 *
59 * Permission is hereby granted, free of charge, to any person obtaining a
60 * copy of this software and associated documentation files (the "Software"),
61 * to deal in the Software without restriction, including without limitation
62 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
63 * and/or sell copies of the Software, and to permit persons to whom the
64 * Software is furnished to do so, subject to the following conditions:
65 *
66 * The above copyright notice and this permission notice (including the next
67 * paragraph) shall be included in all copies or substantial portions of the
68 * Software.
69 *
70 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
73 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
75 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
76 * DEALINGS IN THE SOFTWARE.
77 *
78 * Author: Daniel Stone <daniel@fooishbar.org>
79 */
80
81 #ifndef _XKBCOMMON_H_
82 #define _XKBCOMMON_H_
83
84 #include <stdint.h>
85 #include <stdio.h>
86 #include <stdarg.h>
87
88 #include <xkbcommon/xkbcommon-names.h>
89 #include <xkbcommon/xkbcommon-keysyms.h>
90
91 #ifdef __cplusplus
92 extern "C" {
93 #endif
94
111 struct xkb_context;
112
123 struct xkb_keymap;
124
134 struct xkb_state;
135
161 typedef uint32_t xkb_keycode_t;
162
191 typedef uint32_t xkb_keysym_t;
192
211 typedef uint32_t xkb_layout_index_t;
213 typedef uint32_t xkb_layout_mask_t;
214
227 typedef uint32_t xkb_level_index_t;
228
252 typedef uint32_t xkb_mod_index_t;
254 typedef uint32_t xkb_mod_mask_t;
255
281 typedef uint32_t xkb_led_index_t;
283 typedef uint32_t xkb_led_mask_t;
284
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)
290
291 #define XKB_KEYCODE_MAX (0xffffffff - 1)
292
297 #define xkb_keycode_is_legal_ext(key) (key <= XKB_KEYCODE_MAX)
298
303 #define xkb_keycode_is_legal_x11(key) (key >= 8 && key <= 255)
304
313 struct xkb_rule_names {
316 const char *rules;
318 const char *model;
321 const char *layout;
324 const char *variant;
328 const char *options;
329 };
330
358 int
359 xkb_keysym_get_name(xkb_keysym_t keysym, char *buffer, size_t size);
360
362 enum xkb_keysym_flags {
364 XKB_KEYSYM_NO_FLAGS = 0,
366 XKB_KEYSYM_CASE_INSENSITIVE = (1 << 0)
367 };
368
389 xkb_keysym_t
390 xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags);
391
403 int
404 xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size);
405
413 uint32_t
414 xkb_keysym_to_utf32(xkb_keysym_t keysym);
415
429 enum xkb_context_flags {
431 XKB_CONTEXT_NO_FLAGS = 0,
433 XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0),
435 XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1),
436 };
437
451 struct xkb_context *
452 xkb_context_new(enum xkb_context_flags flags);
453
461 struct xkb_context *
462 xkb_context_ref(struct xkb_context *context);
463
471 void
472 xkb_context_unref(struct xkb_context *context);
473
482 void
483 xkb_context_set_user_data(struct xkb_context *context, void *user_data);
484
496 void *
497 xkb_context_get_user_data(struct xkb_context *context);
498
520 int
521 xkb_context_include_path_append(struct xkb_context *context, const char *path);
522
530 int
531 xkb_context_include_path_append_default(struct xkb_context *context);
532
543 int
544 xkb_context_include_path_reset_defaults(struct xkb_context *context);
545
551 void
552 xkb_context_include_path_clear(struct xkb_context *context);
553
559 unsigned int
560 xkb_context_num_include_paths(struct xkb_context *context);
561
570 const char *
571 xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
572
583 enum xkb_log_level {
584 XKB_LOG_LEVEL_CRITICAL = 10,
585 XKB_LOG_LEVEL_ERROR = 20,
586 XKB_LOG_LEVEL_WARNING = 30,
587 XKB_LOG_LEVEL_INFO = 40,
588 XKB_LOG_LEVEL_DEBUG = 50
589 };
590
604 void
605 xkb_context_set_log_level(struct xkb_context *context,
606 enum xkb_log_level level);
607
613 enum xkb_log_level
614 xkb_context_get_log_level(struct xkb_context *context);
615
635 void
636 xkb_context_set_log_verbosity(struct xkb_context *context, int verbosity);
637
643 int
644 xkb_context_get_log_verbosity(struct xkb_context *context);
645
666 void
667 xkb_context_set_log_fn(struct xkb_context *context,
668 void (*log_fn)(struct xkb_context *context,
669 enum xkb_log_level level,
670 const char *format, va_list args));
671
682 enum xkb_keymap_compile_flags {
684 XKB_MAP_COMPILE_NO_FLAGS = 0,
686 XKB_MAP_COMPILE_PLACEHOLDER = 0
687 };
688
710 struct xkb_keymap *
711 xkb_keymap_new_from_names(struct xkb_context *context,
712 const struct xkb_rule_names *names,
713 enum xkb_keymap_compile_flags flags);
714
716 enum xkb_keymap_format {
718 XKB_KEYMAP_FORMAT_TEXT_V1 = 1
719 };
720
739 struct xkb_keymap *
740 xkb_keymap_new_from_file(struct xkb_context *context, FILE *file,
741 enum xkb_keymap_format format,
742 enum xkb_keymap_compile_flags flags);
743
753 struct xkb_keymap *
754 xkb_keymap_new_from_string(struct xkb_context *context, const char *string,
755 enum xkb_keymap_format format,
756 enum xkb_keymap_compile_flags flags);
757
767 struct xkb_keymap *
768 xkb_keymap_new_from_buffer(struct xkb_context *context, const char *buffer,
769 size_t length, enum xkb_keymap_format format,
770 enum xkb_keymap_compile_flags flags);
771
779 struct xkb_keymap *
780 xkb_keymap_ref(struct xkb_keymap *keymap);
781
789 void
790 xkb_keymap_unref(struct xkb_keymap *keymap);
791
796 #define XKB_KEYMAP_USE_ORIGINAL_FORMAT ((enum xkb_keymap_format) -1)
797
816 char *
817 xkb_keymap_get_as_string(struct xkb_keymap *keymap,
818 enum xkb_keymap_format format);
819
835 xkb_keycode_t
836 xkb_keymap_min_keycode(struct xkb_keymap *keymap);
837
844 xkb_keycode_t
845 xkb_keymap_max_keycode(struct xkb_keymap *keymap);
846
853 typedef void
854 (*xkb_keymap_key_iter_t)(struct xkb_keymap *keymap, xkb_keycode_t key,
855 void *data);
856
865 void
866 xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter,
867 void *data);
868
875 xkb_mod_index_t
876 xkb_keymap_num_mods(struct xkb_keymap *keymap);
877
886 const char *
887 xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
888
898 xkb_mod_index_t
899 xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name);
900
907 xkb_layout_index_t
908 xkb_keymap_num_layouts(struct xkb_keymap *keymap);
909
919 const char *
920 xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx);
921
931 xkb_layout_index_t
932 xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name);
933
944 xkb_layout_index_t
945 xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t key);
946
957 xkb_level_index_t
958 xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t key,
959 xkb_layout_index_t layout);
960
989 int
990 xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap,
991 xkb_keycode_t key,
992 xkb_layout_index_t layout,
993 xkb_level_index_t level,
994 const xkb_keysym_t **syms_out);
995
1007 xkb_led_index_t
1008 xkb_keymap_num_leds(struct xkb_keymap *keymap);
1009
1017 const char *
1018 xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
1019
1028 xkb_led_index_t
1029 xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name);
1030
1046 int
1047 xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
1048
1067 struct xkb_state *
1068 xkb_state_new(struct xkb_keymap *keymap);
1069
1077 struct xkb_state *
1078 xkb_state_ref(struct xkb_state *state);
1079
1087 void
1088 xkb_state_unref(struct xkb_state *state);
1089
1102 struct xkb_keymap *
1103 xkb_state_get_keymap(struct xkb_state *state);
1104
1106 enum xkb_key_direction {
1107 XKB_KEY_UP,
1108 XKB_KEY_DOWN
1109 };
1110
1118 enum xkb_state_component {
1120 XKB_STATE_MODS_DEPRESSED = (1 << 0),
1123 XKB_STATE_MODS_LATCHED = (1 << 1),
1126 XKB_STATE_MODS_LOCKED = (1 << 2),
1130 XKB_STATE_MODS_EFFECTIVE = (1 << 3),
1132 XKB_STATE_LAYOUT_DEPRESSED = (1 << 4),
1135 XKB_STATE_LAYOUT_LATCHED = (1 << 5),
1138 XKB_STATE_LAYOUT_LOCKED = (1 << 6),
1142 XKB_STATE_LAYOUT_EFFECTIVE = (1 << 7),
1144 XKB_STATE_LEDS = (1 << 8)
1145 };
1146
1169 enum xkb_state_component
1170 xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
1171 enum xkb_key_direction direction);
1172
1200 enum xkb_state_component
1201 xkb_state_update_mask(struct xkb_state *state,
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);
1208
1233 int
1234 xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
1235 const xkb_keysym_t **syms_out);
1236
1252 xkb_keysym_t
1253 xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t key);
1254
1269 xkb_layout_index_t
1270 xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t key);
1271
1294 xkb_level_index_t
1295 xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t key,
1296 xkb_layout_index_t layout);
1297
1304 enum xkb_state_match {
1306 XKB_STATE_MATCH_ANY = (1 << 0),
1308 XKB_STATE_MATCH_ALL = (1 << 1),
1311 XKB_STATE_MATCH_NON_EXCLUSIVE = (1 << 16)
1312 };
1313
1332 xkb_mod_mask_t
1333 xkb_state_serialize_mods(struct xkb_state *state,
1334 enum xkb_state_component components);
1335
1354 xkb_layout_index_t
1355 xkb_state_serialize_layout(struct xkb_state *state,
1356 enum xkb_state_component components);
1357
1366 int
1367 xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
1368 enum xkb_state_component type);
1369
1387 int
1388 xkb_state_mod_names_are_active(struct xkb_state *state,
1389 enum xkb_state_component type,
1390 enum xkb_state_match match,
1391 ...);
1392
1401 int
1402 xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
1403 enum xkb_state_component type);
1404
1422 int
1423 xkb_state_mod_indices_are_active(struct xkb_state *state,
1424 enum xkb_state_component type,
1425 enum xkb_state_match match,
1426 ...);
1427
1490 int
1491 xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
1492 xkb_mod_index_t idx);
1493
1503 xkb_mod_mask_t
1504 xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
1505 xkb_mod_mask_t mask);
1506
1519 int
1520 xkb_state_layout_name_is_active(struct xkb_state *state, const char *name,
1521 enum xkb_state_component type);
1522
1532 int
1533 xkb_state_layout_index_is_active(struct xkb_state *state,
1534 xkb_layout_index_t idx,
1535 enum xkb_state_component type);
1536
1546 int
1547 xkb_state_led_name_is_active(struct xkb_state *state, const char *name);
1548
1558 int
1559 xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx);
1560
1563 /* Leave this include last, so it can pick up our types, etc. */
1564 #include <xkbcommon/xkbcommon-compat.h>
1565
1566 #ifdef __cplusplus
1567 } /* extern "C" */
1568 #endif
1569
1570 #endif /* _XKBCOMMON_H_ */
xkb_keymap::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.
xkb_context::xkb_context_set_log_verbosity
void xkb_context_set_log_verbosity(struct xkb_context *context, int verbosity)
Sets the current logging verbosity.
XKB_STATE_MODS_EFFECTIVE
Effective modifiers, i.e.
Definition: xkbcommon.h:1130
xkb_state::xkb_state_get_keymap
struct xkb_keymap * xkb_state_get_keymap(struct xkb_state *state)
Get the keymap which a keyboard state object is using.
xkb_keymap::xkb_keymap_ref
struct xkb_keymap * xkb_keymap_ref(struct xkb_keymap *keymap)
Take a new reference on a keymap.
XKB_LOG_LEVEL_WARNING
Log warnings and errors.
Definition: xkbcommon.h:586
XKB_KEY_DOWN
The key was pressed.
Definition: xkbcommon.h:1108
xkbcommon-names.h
Predefined names for common modifiers and LEDs.
xkb_context::xkb_context_include_path_reset_defaults
int xkb_context_include_path_reset_defaults(struct xkb_context *context)
Reset the context's include path to the default.
xkb_context::xkb_context_new
struct xkb_context * xkb_context_new(enum xkb_context_flags flags)
Create a new context.
xkb_state::xkb_state_key_get_level
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.
xkb_state::xkb_state_update_key
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.
xkb_keysym_to_utf8
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
xkb_state_component
Modifier and layout types for state objects.
Definition: xkbcommon.h:1118
XKB_LOG_LEVEL_INFO
Log information, warnings, and errors.
Definition: xkbcommon.h:587
XKB_STATE_MATCH_NON_EXCLUSIVE
Makes matching non-exclusive, i.e.
Definition: xkbcommon.h:1311
xkb_context
Opaque top level library context object.
xkb_keysym_to_utf32
uint32_t xkb_keysym_to_utf32(xkb_keysym_t keysym)
Get the Unicode/UTF-32 representation of a keysym.
XKB_STATE_MODS_LOCKED
Locked modifiers, i.e.
Definition: xkbcommon.h:1126
XKB_STATE_LAYOUT_DEPRESSED
Depressed layout, i.e.
Definition: xkbcommon.h:1132
xkb_state::xkb_state_layout_name_is_active
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_keymap::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.
xkb_keysym_get_name
int xkb_keysym_get_name(xkb_keysym_t keysym, char *buffer, size_t size)
Get the name of a keysym.
XKB_STATE_MODS_LATCHED
Latched modifiers, i.e.
Definition: xkbcommon.h:1123
XKB_STATE_MATCH_ALL
Returns true if all of the modifiers are active.
Definition: xkbcommon.h:1308
xkb_state::xkb_state_new
struct xkb_state * xkb_state_new(struct xkb_keymap *keymap)
Create a new keyboard state object.
XKB_KEYMAP_FORMAT_TEXT_V1
The current/classic XKB text format, as generated by xkbcomp -xkb.
Definition: xkbcommon.h:718
XKB_CONTEXT_NO_DEFAULT_INCLUDES
Create this context with an empty include path.
Definition: xkbcommon.h:433
xkb_state::xkb_state_mod_index_is_active
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.
xkb_keymap::xkb_keymap_new_from_string
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_keymap::xkb_keymap_num_layouts
xkb_layout_index_t xkb_keymap_num_layouts(struct xkb_keymap *keymap)
Get the number of layouts in the keymap.
xkb_state::xkb_state_key_get_syms
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.
XKB_STATE_LAYOUT_LATCHED
Latched layout, i.e.
Definition: xkbcommon.h:1135
xkb_context::xkb_context_set_user_data
void xkb_context_set_user_data(struct xkb_context *context, void *user_data)
Store custom user data in the context.
XKB_MAP_COMPILE_NO_FLAGS
Do not apply any flags.
Definition: xkbcommon.h:684
xkb_keymap::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.
XKB_LOG_LEVEL_DEBUG
Log everything.
Definition: xkbcommon.h:588
xkb_keymap::xkb_keymap_get_as_string
char * xkb_keymap_get_as_string(struct xkb_keymap *keymap, enum xkb_keymap_format format)
Get the compiled keymap as a string.
xkb_keymap::xkb_keymap_key_iter_t
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_state::xkb_state_serialize_mods
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...
XKB_CONTEXT_NO_FLAGS
Do not apply any context flags.
Definition: xkbcommon.h:431
xkb_keymap::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.
xkb_state::xkb_state_ref
struct xkb_state * xkb_state_ref(struct xkb_state *state)
Take a new reference on a keyboard state object.
xkb_log_level
xkb_log_level
Specifies a logging level.
Definition: xkbcommon.h:583
xkb_state::xkb_state_led_name_is_active
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.
XKB_STATE_LEDS
LEDs (derived from the other state components).
Definition: xkbcommon.h:1144
xkb_context::xkb_context_get_log_verbosity
int xkb_context_get_log_verbosity(struct xkb_context *context)
Get the current logging verbosity of the context.
xkb_context::xkb_context_set_log_level
void xkb_context_set_log_level(struct xkb_context *context, enum xkb_log_level level)
Set the current logging level.
XKB_MAP_COMPILE_PLACEHOLDER
Apparently you can't have empty enums.
Definition: xkbcommon.h:686
xkb_led_mask_t
uint32_t xkb_led_mask_t
A mask of LED indices.
Definition: xkbcommon.h:283
xkb_context::xkb_context_ref
struct xkb_context * xkb_context_ref(struct xkb_context *context)
Take a new reference on a context.
xkb_keymap_compile_flags
xkb_keymap_compile_flags
Flags for keymap compilation.
Definition: xkbcommon.h:682
XKB_STATE_LAYOUT_EFFECTIVE
Effective layout, i.e.
Definition: xkbcommon.h:1142
xkb_keymap::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.
xkb_keymap::xkb_keymap_num_leds
xkb_led_index_t xkb_keymap_num_leds(struct xkb_keymap *keymap)
Get the number of LEDs in the keymap.
xkb_led_index_t
uint32_t xkb_led_index_t
Index of a keyboard LED.
Definition: xkbcommon.h:281
xkb_context::xkb_context_include_path_clear
void xkb_context_include_path_clear(struct xkb_context *context)
Remove all entries from the context's include path.
xkb_context::xkb_context_set_log_fn
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.
xkb_context::xkb_context_include_path_append
int xkb_context_include_path_append(struct xkb_context *context, const char *path)
Append a new entry to the context's include path.
xkb_state::xkb_state_key_get_one_sym
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...
xkb_state::xkb_state_unref
void xkb_state_unref(struct xkb_state *state)
Release a reference on a keybaord state object, and possibly free it.
xkb_state::xkb_state_mod_name_is_active
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_state::xkb_state_key_get_layout
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.
xkb_rule_names::variant
const char * variant
A comma separated list of variants, one per layout, which may modify or augment the respective layout...
Definition: xkbcommon.h:324
xkb_keymap::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.
xkb_state::xkb_state_mod_mask_remove_consumed
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_state::xkb_state_serialize_layout
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...
xkb_state::xkb_state_mod_index_is_consumed
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.
xkb_keymap::xkb_keymap_new_from_buffer
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.
xkb_keymap::xkb_keymap_unref
void xkb_keymap_unref(struct xkb_keymap *keymap)
Release a reference on a keymap, and possibly free it.
xkb_mod_mask_t
uint32_t xkb_mod_mask_t
A mask of modifier indices.
Definition: xkbcommon.h:254
xkb_keymap::xkb_keymap_min_keycode
xkb_keycode_t xkb_keymap_min_keycode(struct xkb_keymap *keymap)
Get the minimum keycode in the keymap.
xkb_keysym_from_name
xkb_keysym_t xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags)
Get a keysym from its name.
xkb_keymap::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.
xkb_state::xkb_state_led_index_is_active
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.
XKB_KEY_UP
The key was released.
Definition: xkbcommon.h:1107
xkb_keymap::xkb_keymap_max_keycode
xkb_keycode_t xkb_keymap_max_keycode(struct xkb_keymap *keymap)
Get the maximum keycode in the keymap.
xkb_context::xkb_context_unref
void xkb_context_unref(struct xkb_context *context)
Release a reference on a context, and possibly free it.
xkb_state::xkb_state_mod_indices_are_active
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.
XKB_STATE_MODS_DEPRESSED
Depressed modifiers, i.e.
Definition: xkbcommon.h:1120
xkb_keymap::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.
xkb_keycode_t
uint32_t xkb_keycode_t
A number used to represent a physical key on a keyboard.
Definition: xkbcommon.h:134
xkb_keymap::xkb_keymap_new_from_file
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
xkb_key_direction
Specifies the direction of the key (press / release).
Definition: xkbcommon.h:1106
xkb_keymap::xkb_keymap_num_mods
xkb_mod_index_t xkb_keymap_num_mods(struct xkb_keymap *keymap)
Get the number of modifiers in the keymap.
XKB_KEYSYM_CASE_INSENSITIVE
Find keysym by case-insensitive search.
Definition: xkbcommon.h:366
xkb_keymap::xkb_keymap_new_from_names
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.
xkb_rule_names::model
const char * model
The keyboard model by which to interpret keycodes and LEDs.
Definition: xkbcommon.h:318
xkb_layout_index_t
uint32_t xkb_layout_index_t
Index of a keyboard layout.
Definition: xkbcommon.h:211
XKB_CONTEXT_NO_ENVIRONMENT_NAMES
Don't take RMLVO names from the environment.
Definition: xkbcommon.h:435
xkb_rule_names::options
const char * options
A comma separated list of options, through which the user specifies non-layout related preferences...
Definition: xkbcommon.h:328
XKB_KEYSYM_NO_FLAGS
Do not apply any flags.
Definition: xkbcommon.h:364
XKB_STATE_MATCH_ANY
Returns true if any of the modifiers are active.
Definition: xkbcommon.h:1306
xkb_keymap::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.
xkb_context::xkb_context_include_path_get
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.
xkb_keysym_t
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
xkb_context_flags
Flags for context creation.
Definition: xkbcommon.h:429
xkb_rule_names::rules
const char * rules
The rules file to use.
Definition: xkbcommon.h:316
xkb_level_index_t
uint32_t xkb_level_index_t
Index of a shift level.
Definition: xkbcommon.h:227
XKB_STATE_LAYOUT_LOCKED
Locked layout, i.e.
Definition: xkbcommon.h:1138
xkb_mod_index_t
uint32_t xkb_mod_index_t
Index of a modifier.
Definition: xkbcommon.h:252
xkb_keymap::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.
xkb_context::xkb_context_get_user_data
void * xkb_context_get_user_data(struct xkb_context *context)
Retrieves stored user data from the context.
xkb_context::xkb_context_get_log_level
enum xkb_log_level xkb_context_get_log_level(struct xkb_context *context)
Get the current logging level.
xkb_state
Opaque keyboard state object.
Definition: xkbcommon.h:123
xkb_keymap
Opaque compiled keymap object.
Definition: xkbcommon.h:111
xkb_rule_names
Names to compile a keymap with, also known as RMLVO.
Definition: xkbcommon.h:313
xkb_rule_names::layout
const char * layout
A comma separated list of layouts (languages) to include in the keymap.
Definition: xkbcommon.h:321
xkb_context::xkb_context_num_include_paths
unsigned int xkb_context_num_include_paths(struct xkb_context *context)
Get the number of paths in the context's include path.
xkb_state::xkb_state_mod_names_are_active
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.
xkb_state::xkb_state_update_mask
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
xkb_keysym_flags
Flags for xkb_keysym_from_name().
Definition: xkbcommon.h:362
xkb_state::xkb_state_layout_index_is_active
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
xkb_keymap_format
The possible keymap formats.
Definition: xkbcommon.h:716
xkb_state_match
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
XKB_LOG_LEVEL_CRITICAL
Log critical internal errors only.
Definition: xkbcommon.h:584
xkb_context::xkb_context_include_path_append_default
int xkb_context_include_path_append_default(struct xkb_context *context)
Append the default include paths to the context's include path.
XKB_LOG_LEVEL_ERROR
Log all errors.
Definition: xkbcommon.h:585
xkb_keymap::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.
xkb_layout_mask_t
uint32_t xkb_layout_mask_t
A mask of layout indices.
Definition: xkbcommon.h:213