Debian Codegraph @

src/keysym.h.jinja

raw
1 /*
2 * NOTE: This file has been generated automatically by “{{script}}”.
3 * Do not edit manually!
4 */
5
6 /*
7 * For MIT-open-group:
8 * Copyright 1985, 1987, 1990, 1998 The Open Group
9 *
10 * For MIT:
11 * Copyright © 2009 Dan Nicholson
12 *
13 * SPDX-License-Identifier: MIT-open-group AND MIT
14 */
15 #pragma once
16
17 #include "config.h"
18
19 #include <stdbool.h>
20
21 #include "xkbcommon/xkbcommon.h"
22
23 #include "utils.h"
24
25 /*
26 * NOTE: this is not defined in xkbcommon.h, because if we did, it may add
27 * overhead for library user: when handling keysyms they would also need to
28 * check min keysym when previously there was no reason to.
29 */
30 /** Minimum keysym value */
31 #define XKB_KEYSYM_MIN 0x00000000
32 /** Minimum keysym value assigned */
33 #define XKB_KEYSYM_MIN_ASSIGNED ((xkb_keysym_t){{ XKB_KEYSYM_MIN_ASSIGNED | keysym }})
34 /** Maximum keysym value assigned */
35 #define XKB_KEYSYM_MAX_ASSIGNED {{ XKB_KEYSYM_MAX_ASSIGNED | keysym }}
36 /** Minimum keysym value with explicit name */
37 #define XKB_KEYSYM_MIN_EXPLICIT {{ XKB_KEYSYM_MIN_EXPLICIT | keysym }}
38 /** Maximum keysym value with explicit name */
39 #define XKB_KEYSYM_MAX_EXPLICIT {{ XKB_KEYSYM_MAX_EXPLICIT | keysym }}
40 /** Count of keysym value with explicit name */
41 #define XKB_KEYSYM_COUNT_EXPLICIT {{ XKB_KEYSYM_COUNT_EXPLICIT }}
42 /** Offset to use when converting a Unicode code point to a keysym */
43 #define XKB_KEYSYM_UNICODE_OFFSET 0x01000000
44 /** Minimum Unicode keysym. NOTE: code points in 0..0xff cannot be converted. */
45 #define XKB_KEYSYM_UNICODE_MIN 0x01000100
46 /** Minimum Unicode surrogate keysym */
47 #define XKB_KEYSYM_UNICODE_SURROGATE_MIN 0x0100d800
48 /** Maximum Unicode surrogate keysym */
49 #define XKB_KEYSYM_UNICODE_SURROGATE_MAX 0x0100dfff
50 /** Maximum Unicode keysym, corresponding to the maximum Unicode code point */
51 #define XKB_KEYSYM_UNICODE_MAX 0x0110ffff
52 /** Unicode version used for case mappings */
53 #define XKB_KEYSYM_UNICODE_VERSION { 17, 0, 0, 0 }
54 /** Maximum keysym canonical name length, plus terminating NULL byte */
55 #define XKB_KEYSYM_NAME_MAX_SIZE {{ XKB_KEYSYM_NAME_MAX_SIZE }}
56 /** Longest keysym canonical name */
57 #define XKB_KEYSYM_LONGEST_CANONICAL_NAME {{ XKB_KEYSYM_LONGEST_CANONICAL_NAME }}
58 /** Longest keysym name */
59 #define XKB_KEYSYM_LONGEST_NAME {{ XKB_KEYSYM_LONGEST_NAME }}
60 /** Maximum of distinct explicit names for a keysym */
61 #define XKB_KEYSYM_EXPLICIT_ALIASES_MAX {{ XKB_KEYSYM_EXPLICIT_ALIASES_MAX }}
62 /** Maximum bytes to encode the Unicode representation of a keysym in UTF-8:
63 * 4 bytes + NULL-terminating byte */
64 #define XKB_KEYSYM_UTF8_MAX_SIZE 5
65
66 XKB_EXPORT_PRIVATE bool
67 xkb_keysym_is_assigned(xkb_keysym_t ks);
68
69 XKB_EXPORT_PRIVATE int
70 xkb_keysym_get_explicit_names(xkb_keysym_t ks, const char **buffer, size_t size);
71
72 struct xkb_keysym_iterator;
73
74 XKB_EXPORT_PRIVATE struct xkb_keysym_iterator*
75 xkb_keysym_iterator_new(bool explicit);
76
77 XKB_EXPORT_PRIVATE struct xkb_keysym_iterator*
78 xkb_keysym_iterator_unref(struct xkb_keysym_iterator *iter);
79
80 XKB_EXPORT_PRIVATE bool
81 xkb_keysym_iterator_next(struct xkb_keysym_iterator *iter);
82
83 XKB_EXPORT_PRIVATE xkb_keysym_t
84 xkb_keysym_iterator_get_keysym(struct xkb_keysym_iterator *iter);
85
86 XKB_EXPORT_PRIVATE int
87 xkb_keysym_iterator_get_name(struct xkb_keysym_iterator *iter,
88 char *buffer, size_t size);
89
90 XKB_EXPORT_PRIVATE bool
91 xkb_keysym_iterator_is_explicitly_named(struct xkb_keysym_iterator *iter);
92
93 XKB_EXPORT_PRIVATE bool
94 xkb_keysym_is_deprecated(xkb_keysym_t keysym,
95 const char *name,
96 const char **reference_name);
97
98 #define XKB_MIN_VERBOSITY_DEPRECATED_KEYSYM 2
99 #define check_deprecated_keysyms(log_func, log_param, ctx, keysym, name, token, format, end) \
100 if (unlikely((ctx)->log_verbosity >= XKB_MIN_VERBOSITY_DEPRECATED_KEYSYM)) { \
101 const char *ref_name = NULL; \
102 if (xkb_keysym_is_deprecated(keysym, name, &ref_name)) { \
103 if (ref_name == NULL) \
104 log_func(log_param, XKB_WARNING_DEPRECATED_KEYSYM, \
105 "deprecated keysym \"" format "\"." end, token); \
106 else \
107 log_func(log_param, XKB_WARNING_DEPRECATED_KEYSYM_NAME, \
108 "deprecated keysym name \"" format "\"; " \
109 "please use \"%s\" instead." end, \
110 token, ref_name); \
111 } \
112 }
113
114 XKB_EXPORT_PRIVATE bool
115 xkb_keysym_is_lower(xkb_keysym_t keysym);
116
117 XKB_EXPORT_PRIVATE bool
118 xkb_keysym_is_upper_or_title(xkb_keysym_t keysym);
119
120 XKB_EXPORT_PRIVATE bool
121 xkb_keysym_is_keypad(xkb_keysym_t keysym);
122
123 XKB_EXPORT_PRIVATE bool
124 xkb_keysym_is_modifier(xkb_keysym_t keysym);