kbproto unentanglement: XkbExplicit*Mask
[platform/upstream/libxkbcommon.git] / xkbcommon / xkbcommon.h
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 Daniel Stone
56  *
57  * Permission is hereby granted, free of charge, to any person obtaining a
58  * copy of this software and associated documentation files (the "Software"),
59  * to deal in the Software without restriction, including without limitation
60  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
61  * and/or sell copies of the Software, and to permit persons to whom the
62  * Software is furnished to do so, subject to the following conditions:
63  *
64  * The above copyright notice and this permission notice (including the next
65  * paragraph) shall be included in all copies or substantial portions of the
66  * Software.
67  *
68  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
71  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
73  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
74  * DEALINGS IN THE SOFTWARE.
75  *
76  * Author: Daniel Stone <daniel@fooishbar.org>
77  */
78
79 #ifndef _XKBCOMMON_H_
80 #define _XKBCOMMON_H_
81
82 #include <stddef.h>
83 #include <stdint.h>
84 #include <stdio.h>
85
86 #include <xkbcommon/xkbcommon-names.h>
87 #include <xkbcommon/xkbcommon-keysyms.h>
88
89 typedef uint32_t xkb_keycode_t;
90 typedef uint32_t xkb_keysym_t;
91 typedef uint32_t xkb_mod_index_t;
92 typedef uint32_t xkb_mod_mask_t;
93 typedef uint32_t xkb_group_index_t;
94 typedef uint32_t xkb_group_mask_t;
95 typedef uint32_t xkb_led_index_t;
96
97 #define XKB_MOD_INVALID     (0xffffffff)
98 #define XKB_GROUP_INVALID   (0xffffffff)
99 #define XKB_KEYCODE_INVALID (0xffffffff)
100 #define XKB_LED_INVALID     (0xffffffff)
101
102 #define XKB_KEYCODE_MAX     (0xffffffff - 1)
103 #define xkb_keycode_is_legal_ext(kc) (kc <= XKB_KEYCODE_MAX)
104 #define xkb_keycode_is_legal_x11(kc) (kc >= 8 && kc <= 255)
105
106 /**
107  * Names to compile a keymap with, also known as RMLVO.  These names together
108  * should be the primary identifier for a keymap.
109  */
110 struct xkb_rule_names {
111     const char *rules;
112     const char *model;
113     const char *layout;
114     const char *variant;
115     const char *options;
116 };
117
118 /**
119  * Opaque context object; may only be created, accessed, manipulated and
120  * destroyed through the xkb_context_*() API.
121  */
122 struct xkb_context;
123
124 /**
125  * Opaque keymap object; may only be created, accessed, manipulated and
126  * destroyed through the xkb_state_*() API.
127  */
128 struct xkb_keymap;
129
130 /**
131  * Opaque state object; may only be created, accessed, manipulated and
132  * destroyed through the xkb_state_*() API.
133  */
134 struct xkb_state;
135
136 #ifdef __cplusplus
137 extern "C" {
138 #endif
139
140 /*
141  * Returns the name for a keysym as a string; will return unknown Unicode
142  * codepoints as "Ua1b2", and other unknown keysyms as "0xabcd1234".
143  * If the buffer passed is too small, the string is truncated; a size of
144  * at least 32 bytes is recommended.
145  */
146 void
147 xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size);
148
149 /*
150  * See xkb_keysym_get_name comments: this function will accept any string
151  * from that function.
152  */
153 xkb_keysym_t
154 xkb_keysym_from_name(const char *s);
155
156 /**
157  * Return the printable representation of the keystring in Unicode/UTF-8.
158  * The buffer passed must be at least 7 bytes long.  The return value
159  * is the number of bytes written to the buffer.  A return value of zero
160  * means that the keysym does not have a known printable Unicode
161  * representation, and a return value of -1 means that the buffer was too
162  * small to contain the return.
163  */
164 int
165 xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size);
166
167 /**
168  * Returns the Unicode/UTF-32 representation of the provided keysym, which is
169  * also compatible with UCS-4.  A return value of zero means the keysym does
170  * not have a known printable Unicode representation.
171  */
172 uint32_t
173 xkb_keysym_to_utf32(xkb_keysym_t keysym);
174
175 /**
176  * @defgroup context XKB contexts
177  * Every keymap compilation request must have an XKB context associated with
178  * it.  The context keeps around state such as the include path.
179  *
180  * @{
181  */
182
183 enum xkb_context_flags {
184     /** Create this context with an empty include path. */
185     XKB_CONTEXT_NO_DEFAULT_INCLUDES = 1,
186 };
187
188 /**
189  * Returns a new XKB context, or NULL on failure.  If successful, the caller
190  * holds a reference on the context, and must free it when finished with
191  * xkb_context_unref().
192  */
193 struct xkb_context *
194 xkb_context_new(enum xkb_context_flags flags);
195
196 /**
197  * Appends a new entry to the include path used for keymap compilation.
198  * Returns 1 on success, or 0 if the include path could not be added or is
199  * inaccessible.
200  */
201 int
202 xkb_context_include_path_append(struct xkb_context *context, const char *path);
203
204 /**
205  * Appends the default include paths to the context's current include path.
206  * Returns 1 on success, or 0 if the primary include path could not be
207  * added.
208  */
209 int
210 xkb_context_include_path_append_default(struct xkb_context *context);
211
212 /**
213  * Removes all entries from the context's include path, and inserts the
214  * default paths.  Returns 1 on success, or 0 if the primary include path
215  * could not be added.
216  */
217 int
218 xkb_context_include_path_reset_defaults(struct xkb_context *context);
219
220 /**
221  * Removes all entries from the context's include path.
222  */
223 void
224 xkb_context_include_path_clear(struct xkb_context *context);
225
226 /**
227  * Returns the number of include paths currently active in the context.
228  */
229 unsigned int
230 xkb_context_num_include_paths(struct xkb_context *context);
231
232 /**
233  * Returns the include path at the specified index within the context.
234  */
235 const char *
236 xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
237
238 /**
239  * Takes a new reference on an XKB context.
240  */
241 struct xkb_context *
242 xkb_context_ref(struct xkb_context *context);
243
244 /**
245  * Releases a reference on an XKB context, and possibly frees it.
246  */
247 void
248 xkb_context_unref(struct xkb_context *context);
249
250 /** @} */
251
252 /**
253  * @defgroup logging Logging handling
254  * These functions allow you to manipulate how logging from this library
255  * will be handled.
256  *
257  * @{
258  */
259
260 enum xkb_log_level {
261     /** Log critical internal errors only */
262     XKB_LOG_LEVEL_CRITICAL = 10,
263     /** Log all errors */
264     XKB_LOG_LEVEL_ERROR = 20,
265     /** Log warnings and errors */
266     XKB_LOG_LEVEL_WARNING = 30,
267     /** Log information, warnings, and errors */
268     XKB_LOG_LEVEL_INFO = 40,
269     /** Log all the things */
270     XKB_LOG_LEVEL_DEBUG = 50,
271 };
272
273 /**
274  * Sets the function to be called for logging messages.
275  * Passing NULL restores the default function, which logs to stderr.
276  **/
277 void
278 xkb_set_log_fn(struct xkb_context *context,
279                void (*log_fn)(struct xkb_context *context,
280                               enum xkb_log_level level,
281                               const char *format, va_list args));
282 /**
283  * Sets the current logging level.  The value controls which messages
284  * are logged.  The default level is XKB_LOG_LEVEL_ERROR.
285  *
286  * The environment variable XKB_LOG, if set, overrides the default value
287  * and may be specified as a level number or name.
288  */
289 void
290 xkb_set_log_level(struct xkb_context *context, enum xkb_log_level level);
291
292 /**
293  * Returns the current logging level.
294  */
295 enum xkb_log_level
296 xkb_get_log_level(struct xkb_context *context);
297
298 /**
299  * Sets the current logging verbosity, a value from 0 to 10.
300  *
301  * The library can generate a number of warnings which are not helpful to
302  * ordinary users of the library.  The verbosity may be increased if more
303  * information is desired (e.g. when developing a keymap).  Defaults to 0.
304  * The environment variable XKB_VERBOSITY, if set, overrdies the default
305  * value.
306  *
307  * Note that most verbose messages are of level XKB_LOG_LEVEL_WARNING
308  * or lower.
309  */
310 void
311 xkb_set_log_verbosity(struct xkb_context *ctx, int verbosity);
312
313 /**
314  * Returns the current logging verbosity.
315  */
316 int
317 xkb_get_log_verbosity(struct xkb_context *ctx);
318
319 /**
320  * Retrieves stored data pointer from the context.  This might be useful
321  * to access from callbacks like a custom logging function.
322  *
323  * If context is NULL, returns NULL.
324  **/
325 void *
326 xkb_get_user_data(struct xkb_context *context);
327
328 /**
329  * Store custom user data in the context.
330  */
331 void
332 xkb_set_user_data(struct xkb_context *context, void *user_data);
333
334 /** @} */
335
336 /**
337  * @defgroup map Keymap management
338  * These utility functions allow you to create and deallocate XKB keymaps.
339  *
340  * @{
341  */
342
343 enum xkb_map_compile_flags {
344     /** Apparently you can't have empty enums.  What a drag. */
345     XKB_MAP_COMPILE_PLACEHOLDER = 0,
346 };
347
348 /**
349  * The primary keymap entry point: creates a new XKB keymap from a set of
350  * RMLVO (Rules + Model + Layout + Variant + Option) names.
351  *
352  * You should almost certainly be using this and nothing else to create
353  * keymaps.
354  */
355 struct xkb_keymap *
356 xkb_map_new_from_names(struct xkb_context *context,
357                        const struct xkb_rule_names *names,
358                        enum xkb_map_compile_flags flags);
359
360 enum xkb_keymap_format {
361     /** The current/classic XKB text format, as generated by xkbcomp -xkb. */
362     XKB_KEYMAP_FORMAT_TEXT_V1 = 1,
363 };
364
365 /**
366  * Creates an XKB keymap from a full text XKB keymap passed into the
367  * file.
368  */
369 struct xkb_keymap *
370 xkb_map_new_from_file(struct xkb_context *context, FILE *file,
371                       enum xkb_keymap_format format,
372                       enum xkb_map_compile_flags flags);
373
374 /**
375  * Creates an XKB keymap from a full text XKB keymap serialized into one
376  * enormous string.
377  */
378 struct xkb_keymap *
379 xkb_map_new_from_string(struct xkb_context *context, const char *string,
380                         enum xkb_keymap_format format,
381                         enum xkb_map_compile_flags flags);
382
383 /**
384  * Returns the compiled XKB map as a string which can later be fed back into
385  * xkb_map_new_from_string to return the exact same keymap.
386  */
387 char *
388 xkb_map_get_as_string(struct xkb_keymap *keymap);
389
390 /**
391  * Takes a new reference on a keymap.
392  */
393 struct xkb_keymap *
394 xkb_map_ref(struct xkb_keymap *keymap);
395
396 /**
397  * Releases a reference on a keymap.
398  */
399 void
400 xkb_map_unref(struct xkb_keymap *keymap);
401
402 /** @} */
403
404 /**
405  * @defgroup components XKB state components
406  * Allows enumeration of state components such as modifiers and groups within
407  * the current keymap.
408  *
409  * @{
410  */
411
412 /**
413  * Returns the number of modifiers active in the keymap.
414  */
415 xkb_mod_index_t
416 xkb_map_num_mods(struct xkb_keymap *keymap);
417
418 /**
419  * Returns the name of the modifier specified by 'idx', or NULL if invalid.
420  */
421 const char *
422 xkb_map_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
423
424 /**
425  * Returns the index of the modifier specified by 'name', or XKB_MOD_INVALID.
426  */
427 xkb_mod_index_t
428 xkb_map_mod_get_index(struct xkb_keymap *keymap, const char *name);
429
430 /**
431  * Returns the number of groups active in the keymap.
432  */
433 xkb_group_index_t
434 xkb_map_num_groups(struct xkb_keymap *keymap);
435
436 /**
437  * Returns the name of the group specified by 'idx', or NULL if invalid.
438  */
439 const char *
440 xkb_map_group_get_name(struct xkb_keymap *keymap, xkb_group_index_t idx);
441
442 /**
443  * Returns the index of the group specified by 'name', or XKB_GROUP_INVALID.
444  */
445 xkb_group_index_t
446 xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name);
447
448 /**
449  * Returns the number of groups active for the specified key.
450  */
451 xkb_group_index_t
452 xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t key);
453
454 /**
455  * Returns 1 if the key should repeat, or 0 otherwise.
456  */
457 int
458 xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
459
460 /**
461  * Returns the number of LEDs in the given map.
462  */
463 xkb_led_index_t
464 xkb_map_num_leds(struct xkb_keymap *keymap);
465
466 /**
467  * Returns the name of the LED specified by 'idx', or NULL if invalid.
468  */
469 const char *
470 xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
471
472 /**
473  * Returns the index of the LED specified by 'name', or XKB_LED_INVALID.
474  */
475 xkb_led_index_t
476 xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name);
477
478 /** @} */
479
480 /**
481  * @defgroup state XKB state objects
482  * Creation, destruction and manipulation of keyboard state objects,
483  * representing modifier and group state.
484  *
485  * @{
486  */
487
488 /**
489  * Returns a new XKB state object for use with the given keymap, or NULL on
490  * failure.
491  */
492 struct xkb_state *
493 xkb_state_new(struct xkb_keymap *keymap);
494
495 /**
496  * Takes a new reference on a state object.
497  */
498 struct xkb_state *
499 xkb_state_ref(struct xkb_state *state);
500
501 /**
502  * Unrefs and potentially deallocates a state object; the caller must not
503  * use the state object after calling this.
504  */
505 void
506 xkb_state_unref(struct xkb_state *state);
507
508 /**
509  * Get the keymap from which the state object was created.  Does not take
510  * a new reference on the map; you must explicitly reference it yourself
511  * if you plan to use it beyond the lifetime of the state.
512  */
513 struct xkb_keymap *
514 xkb_state_get_map(struct xkb_state *state);
515
516 enum xkb_key_direction {
517     XKB_KEY_UP,
518     XKB_KEY_DOWN,
519 };
520
521 /**
522  * Updates a state object to reflect the given key being pressed or released.
523  */
524 void
525 xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
526                      enum xkb_key_direction direction);
527
528 /**
529  * Gives the symbols obtained from pressing a particular key with the given
530  * state.  *syms_out will be set to point to an array of keysyms, with the
531  * return value being the number of symbols in *syms_out.  If the return
532  * value is 0, *syms_out will be set to NULL, as there are no symbols produced
533  * by this event.
534  *
535  * This should be called before xkb_state_update_key.
536  */
537 int
538 xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
539                  const xkb_keysym_t **syms_out);
540
541 /**
542  * Modifier and group types for state objects.  This enum is bitmaskable,
543  * e.g. (XKB_STATE_DEPRESSED | XKB_STATE_LATCHED) is valid to exclude
544  * locked modifiers.
545  */
546 enum xkb_state_component {
547     /** A key holding this modifier or group is currently physically
548      *  depressed; also known as 'base'. */
549     XKB_STATE_DEPRESSED = (1 << 0),
550     /** Modifier or group is latched, i.e. will be unset after the next
551      *  non-modifier key press. */
552     XKB_STATE_LATCHED = (1 << 1),
553     /** Modifier or group is locked, i.e. will be unset after the key
554      *  provoking the lock has been pressed again. */
555     XKB_STATE_LOCKED = (1 << 2),
556     /** Combinatination of depressed, latched, and locked. */
557     XKB_STATE_EFFECTIVE =
558         (XKB_STATE_DEPRESSED | XKB_STATE_LATCHED | XKB_STATE_LOCKED),
559 };
560
561 /**
562  * Match flags for xkb_state_mod_indices_are_active and
563  * xkb_state_mod_names_are_active, specifying how the conditions for a
564  * successful match.  XKB_STATE_MATCH_NON_EXCLUSIVE is bitmaskable with
565  * the other modes.
566  */
567 enum xkb_state_match {
568     /** Returns true if any of the modifiers are active. */
569     XKB_STATE_MATCH_ANY = (1 << 0),
570     /** Returns true if all of the modifiers are active. */
571     XKB_STATE_MATCH_ALL = (1 << 1),
572     /** Makes matching non-exclusive, i.e. will not return false if a
573      *  modifier not specified in the arguments is active. */
574     XKB_STATE_MATCH_NON_EXCLUSIVE = (1 << 16),
575 };
576
577 /**
578  * Updates a state object from a set of explicit masks.  This entrypoint is
579  * really only for window systems and the like, where a master process
580  * holds an xkb_state, then serializes it over a wire protocol, and clients
581  * then use the serialization to feed in to their own xkb_state.
582  *
583  * All parameters must always be passed, or the resulting state may be
584  * incoherent.
585  *
586  * The serialization is lossy and will not survive round trips; it must only
587  * be used to feed slave state objects, and must not be used to update the
588  * master state.
589  *
590  * Please do not use this unless you fit the description above.
591  */
592 void
593 xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods,
594                       xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods,
595                       xkb_group_index_t base_group,
596                       xkb_group_index_t latched_group,
597                       xkb_group_index_t locked_group);
598
599 /**
600  * The counterpart to xkb_state_update_mask, to be used on the server side
601  * of serialization.  Returns a xkb_mod_mask_t representing the given
602  * component(s) of the state.
603  *
604  * This function should not be used in regular clients; please use the
605  * xkb_state_mod_*_is_active or xkb_state_foreach_active_mod API instead.
606  *
607  * Can return NULL on failure.
608  */
609 xkb_mod_mask_t
610 xkb_state_serialize_mods(struct xkb_state *state,
611                          enum xkb_state_component component);
612
613 /**
614  * The group equivalent of xkb_state_serialize_mods: please see its
615  * documentation.
616  */
617 xkb_group_index_t
618 xkb_state_serialize_group(struct xkb_state *state,
619                           enum xkb_state_component component);
620
621 /**
622  * Returns 1 if the modifier specified by 'name' is active in the manner
623  * specified by 'type', 0 if it is unset, or -1 if the modifier does not
624  * exist in the map.
625  */
626 int
627 xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
628                              enum xkb_state_component type);
629
630 /**
631  * Returns 1 if the modifiers specified by the varargs (NULL-terminated
632  * strings, with a NULL sentinel) are active in the manner specified by
633  * 'match', 0 otherwise, or -1 if any of the modifiers do not exist in
634  * the map.
635  */
636 int
637 xkb_state_mod_names_are_active(struct xkb_state *state,
638                                enum xkb_state_component type,
639                                enum xkb_state_match match,
640                                ...);
641
642 /**
643  * Returns 1 if the modifier specified by 'idx' is active in the manner
644  * specified by 'type', 0 if it is unset, or -1 if the modifier does not
645  * exist in the current map.
646  */
647 int
648 xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
649                               enum xkb_state_component type);
650
651 /**
652  * Returns 1 if the modifiers specified by the varargs (of type
653  * xkb_mod_index_t, with a XKB_MOD_INVALID sentinel) are active in the
654  * manner specified by 'match' and 'type', 0 otherwise, or -1 if any of
655  * the modifiers do not exist in the map.
656  */
657 int
658 xkb_state_mod_indices_are_active(struct xkb_state *state,
659                                  enum xkb_state_component type,
660                                  enum xkb_state_match match,
661                                  ...);
662
663 /**
664  * Returns 1 if the modifier specified by 'idx' is used in the
665  * translation of the keycode 'key' to the key symbols obtained by
666  * pressing it (as in xkb_key_get_syms), given the current state.
667  * Returns 0 otherwise.
668  */
669 int
670 xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
671                               xkb_mod_index_t idx);
672
673 /**
674  * Takes the given modifier mask, and removes all modifiers which are
675  * marked as 'consumed' (see xkb_key_mod_index_is_consumed definition)
676  * for that particular key.
677  */
678 xkb_mod_mask_t
679 xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
680                                  xkb_mod_mask_t mask);
681
682 /**
683  * Returns 1 if the group specified by 'name' is active in the manner
684  * specified by 'type', 0 if it is unset, or -1 if the group does not
685  * exist in the current map.
686  */
687 int
688 xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
689                                enum xkb_state_component type);
690
691 /**
692  * Returns 1 if the group specified by 'idx' is active in the manner
693  * specified by 'type', 0 if it is unset, or -1 if the group does not
694  * exist in the current map.
695  */
696 int
697 xkb_state_group_index_is_active(struct xkb_state *state,
698                                 xkb_group_index_t idx,
699                                 enum xkb_state_component type);
700
701 /**
702  * Returns 1 if the LED specified by 'name' is active, 0 if it is unset, or
703  * -1 if the LED does not exist in the current map.
704  */
705 int
706 xkb_state_led_name_is_active(struct xkb_state *state, const char *name);
707
708 /**
709  * Returns 1 if the LED specified by 'idx' is active, 0 if it is unset, or
710  * -1 if the LED does not exist in the current map.
711  */
712 int
713 xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx);
714
715 /** @} */
716
717 #ifdef __cplusplus
718 } /* extern "C" */
719 #endif
720
721 #endif /* _XKBCOMMON_H_ */