xref: /aosp_15_r20/external/libxkbcommon/include/xkbcommon/xkbregistry.h (revision 2b949d0487e80d67f1fda82db69e101e761f8064)
1*2b949d04SAndroid Build Coastguard Worker /*
2*2b949d04SAndroid Build Coastguard Worker  * Copyright © 2020 Red Hat, Inc.
3*2b949d04SAndroid Build Coastguard Worker  *
4*2b949d04SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
5*2b949d04SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
6*2b949d04SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
7*2b949d04SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*2b949d04SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
9*2b949d04SAndroid Build Coastguard Worker  * Software is furnished to do so, subject to the following conditions:
10*2b949d04SAndroid Build Coastguard Worker  *
11*2b949d04SAndroid Build Coastguard Worker  * The above copyright notice and this permission notice (including the next
12*2b949d04SAndroid Build Coastguard Worker  * paragraph) shall be included in all copies or substantial portions of the
13*2b949d04SAndroid Build Coastguard Worker  * Software.
14*2b949d04SAndroid Build Coastguard Worker  *
15*2b949d04SAndroid Build Coastguard Worker  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*2b949d04SAndroid Build Coastguard Worker  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*2b949d04SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18*2b949d04SAndroid Build Coastguard Worker  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*2b949d04SAndroid Build Coastguard Worker  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20*2b949d04SAndroid Build Coastguard Worker  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21*2b949d04SAndroid Build Coastguard Worker  * DEALINGS IN THE SOFTWARE.
22*2b949d04SAndroid Build Coastguard Worker  */
23*2b949d04SAndroid Build Coastguard Worker 
24*2b949d04SAndroid Build Coastguard Worker 
25*2b949d04SAndroid Build Coastguard Worker #ifndef _XKBREGISTRY_H_
26*2b949d04SAndroid Build Coastguard Worker #define _XKBREGISTRY_H_
27*2b949d04SAndroid Build Coastguard Worker 
28*2b949d04SAndroid Build Coastguard Worker #include <stdarg.h>
29*2b949d04SAndroid Build Coastguard Worker #include <stdbool.h>
30*2b949d04SAndroid Build Coastguard Worker 
31*2b949d04SAndroid Build Coastguard Worker /**
32*2b949d04SAndroid Build Coastguard Worker  * @file
33*2b949d04SAndroid Build Coastguard Worker  * @brief Query for available RMLVO
34*2b949d04SAndroid Build Coastguard Worker  *
35*2b949d04SAndroid Build Coastguard Worker  */
36*2b949d04SAndroid Build Coastguard Worker 
37*2b949d04SAndroid Build Coastguard Worker #ifdef __cplusplus
38*2b949d04SAndroid Build Coastguard Worker extern "C" {
39*2b949d04SAndroid Build Coastguard Worker #endif
40*2b949d04SAndroid Build Coastguard Worker 
41*2b949d04SAndroid Build Coastguard Worker /**
42*2b949d04SAndroid Build Coastguard Worker  * @defgroup registry Query for available RMLVO
43*2b949d04SAndroid Build Coastguard Worker  *
44*2b949d04SAndroid Build Coastguard Worker  * The libxkbregistry API to query for available rules, models, layouts,
45*2b949d04SAndroid Build Coastguard Worker  * variants and options (RMLVO). libxkbregistry is a separate library to
46*2b949d04SAndroid Build Coastguard Worker  * libxkbcommon.
47*2b949d04SAndroid Build Coastguard Worker  *
48*2b949d04SAndroid Build Coastguard Worker  * This library is the replacement for clients currently parsing evdev.xml
49*2b949d04SAndroid Build Coastguard Worker  * directly. The library is intended to provide easy access to the set of
50*2b949d04SAndroid Build Coastguard Worker  * **possible** MLVO configurations for a given ruleset. It is not a library to
51*2b949d04SAndroid Build Coastguard Worker  * apply these configurations, merely to enumerate them. The intended users of
52*2b949d04SAndroid Build Coastguard Worker  * this library are the configuration UIs that allow a user to select their
53*2b949d04SAndroid Build Coastguard Worker  * keyboard layout of choice.
54*2b949d04SAndroid Build Coastguard Worker  *
55*2b949d04SAndroid Build Coastguard Worker  * @{
56*2b949d04SAndroid Build Coastguard Worker  */
57*2b949d04SAndroid Build Coastguard Worker 
58*2b949d04SAndroid Build Coastguard Worker /**
59*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_context
60*2b949d04SAndroid Build Coastguard Worker  *
61*2b949d04SAndroid Build Coastguard Worker  * Opaque top level library context object.
62*2b949d04SAndroid Build Coastguard Worker  *
63*2b949d04SAndroid Build Coastguard Worker  * The context contains general library state, like include paths and parsed
64*2b949d04SAndroid Build Coastguard Worker  * data. Objects are created in a specific context, and multiple contexts
65*2b949d04SAndroid Build Coastguard Worker  * may coexist simultaneously. Objects from different contexts are
66*2b949d04SAndroid Build Coastguard Worker  * completely separated and do not share any memory or state.
67*2b949d04SAndroid Build Coastguard Worker  */
68*2b949d04SAndroid Build Coastguard Worker struct rxkb_context;
69*2b949d04SAndroid Build Coastguard Worker 
70*2b949d04SAndroid Build Coastguard Worker /**
71*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_model
72*2b949d04SAndroid Build Coastguard Worker  *
73*2b949d04SAndroid Build Coastguard Worker  * Opaque struct representing an XKB model.
74*2b949d04SAndroid Build Coastguard Worker  */
75*2b949d04SAndroid Build Coastguard Worker struct rxkb_model;
76*2b949d04SAndroid Build Coastguard Worker 
77*2b949d04SAndroid Build Coastguard Worker /**
78*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_layout
79*2b949d04SAndroid Build Coastguard Worker  *
80*2b949d04SAndroid Build Coastguard Worker  * Opaque struct representing an XKB layout, including an optional variant.
81*2b949d04SAndroid Build Coastguard Worker  * Where the variant is NULL, the layout is the base layout.
82*2b949d04SAndroid Build Coastguard Worker  *
83*2b949d04SAndroid Build Coastguard Worker  * For example, "us" is the base layout, "us(intl)" is the "intl" variant of the
84*2b949d04SAndroid Build Coastguard Worker  * layout "us".
85*2b949d04SAndroid Build Coastguard Worker  */
86*2b949d04SAndroid Build Coastguard Worker struct rxkb_layout;
87*2b949d04SAndroid Build Coastguard Worker 
88*2b949d04SAndroid Build Coastguard Worker /**
89*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_option_group
90*2b949d04SAndroid Build Coastguard Worker  *
91*2b949d04SAndroid Build Coastguard Worker  * Opaque struct representing an option group. Option groups divide the
92*2b949d04SAndroid Build Coastguard Worker  * individual options into logical groups. Their main purpose is to indicate
93*2b949d04SAndroid Build Coastguard Worker  * whether some options are mutually exclusive or not.
94*2b949d04SAndroid Build Coastguard Worker  */
95*2b949d04SAndroid Build Coastguard Worker struct rxkb_option_group;
96*2b949d04SAndroid Build Coastguard Worker 
97*2b949d04SAndroid Build Coastguard Worker /**
98*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_option
99*2b949d04SAndroid Build Coastguard Worker  *
100*2b949d04SAndroid Build Coastguard Worker  * Opaque struct representing an XKB option. Options are grouped inside an @ref
101*2b949d04SAndroid Build Coastguard Worker  * rxkb_option_group.
102*2b949d04SAndroid Build Coastguard Worker  */
103*2b949d04SAndroid Build Coastguard Worker struct rxkb_option;
104*2b949d04SAndroid Build Coastguard Worker 
105*2b949d04SAndroid Build Coastguard Worker /**
106*2b949d04SAndroid Build Coastguard Worker  *
107*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_iso639_code
108*2b949d04SAndroid Build Coastguard Worker  *
109*2b949d04SAndroid Build Coastguard Worker  * Opaque struct representing an ISO 639-3 code (e.g. "eng", "fra"). There
110*2b949d04SAndroid Build Coastguard Worker  * is no guarantee that two identical ISO codes share the same struct. You
111*2b949d04SAndroid Build Coastguard Worker  * must not rely on the pointer value of this struct.
112*2b949d04SAndroid Build Coastguard Worker  *
113*2b949d04SAndroid Build Coastguard Worker  * See https://iso639-3.sil.org/code_tables/639/data for a list of codes.
114*2b949d04SAndroid Build Coastguard Worker  */
115*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso639_code;
116*2b949d04SAndroid Build Coastguard Worker 
117*2b949d04SAndroid Build Coastguard Worker /**
118*2b949d04SAndroid Build Coastguard Worker  *
119*2b949d04SAndroid Build Coastguard Worker  * @struct rxkb_iso3166_code
120*2b949d04SAndroid Build Coastguard Worker  *
121*2b949d04SAndroid Build Coastguard Worker  * Opaque struct representing an ISO 3166 Alpha 2 code (e.g. "US", "FR").
122*2b949d04SAndroid Build Coastguard Worker  * There is no guarantee that two identical ISO codes share the same struct.
123*2b949d04SAndroid Build Coastguard Worker  * You must not rely on the pointer value of this struct.
124*2b949d04SAndroid Build Coastguard Worker  *
125*2b949d04SAndroid Build Coastguard Worker  * See https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes for a list
126*2b949d04SAndroid Build Coastguard Worker  * of codes.
127*2b949d04SAndroid Build Coastguard Worker  */
128*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso3166_code;
129*2b949d04SAndroid Build Coastguard Worker 
130*2b949d04SAndroid Build Coastguard Worker /**
131*2b949d04SAndroid Build Coastguard Worker  * Describes the popularity of an item. Historically, some highly specialized or
132*2b949d04SAndroid Build Coastguard Worker  * experimental definitions are excluded from the default list and shipped in
133*2b949d04SAndroid Build Coastguard Worker  * separate files. If these extra definitions are loaded (see @ref
134*2b949d04SAndroid Build Coastguard Worker  * RXKB_CONTEXT_LOAD_EXOTIC_RULES), the popularity of the item is set
135*2b949d04SAndroid Build Coastguard Worker  * accordingly.
136*2b949d04SAndroid Build Coastguard Worker  *
137*2b949d04SAndroid Build Coastguard Worker  * If the exotic items are not loaded, all items will have the standard
138*2b949d04SAndroid Build Coastguard Worker  * popularity.
139*2b949d04SAndroid Build Coastguard Worker  */
140*2b949d04SAndroid Build Coastguard Worker enum rxkb_popularity {
141*2b949d04SAndroid Build Coastguard Worker     RXKB_POPULARITY_STANDARD = 1,
142*2b949d04SAndroid Build Coastguard Worker     RXKB_POPULARITY_EXOTIC,
143*2b949d04SAndroid Build Coastguard Worker };
144*2b949d04SAndroid Build Coastguard Worker 
145*2b949d04SAndroid Build Coastguard Worker /**
146*2b949d04SAndroid Build Coastguard Worker  * Flags for context creation.
147*2b949d04SAndroid Build Coastguard Worker  */
148*2b949d04SAndroid Build Coastguard Worker enum rxkb_context_flags {
149*2b949d04SAndroid Build Coastguard Worker     RXKB_CONTEXT_NO_FLAGS = 0,
150*2b949d04SAndroid Build Coastguard Worker     /**
151*2b949d04SAndroid Build Coastguard Worker      * Skip the default include paths. This requires the caller to call
152*2b949d04SAndroid Build Coastguard Worker      * rxkb_context_include_path_append() or
153*2b949d04SAndroid Build Coastguard Worker      * rxkb_context_include_path_append_default().
154*2b949d04SAndroid Build Coastguard Worker      */
155*2b949d04SAndroid Build Coastguard Worker     RXKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0),
156*2b949d04SAndroid Build Coastguard Worker     /**
157*2b949d04SAndroid Build Coastguard Worker      * Load the extra items that are considered too exotic for the default list.
158*2b949d04SAndroid Build Coastguard Worker      *
159*2b949d04SAndroid Build Coastguard Worker      * For historical reasons, xkeyboard-config ships those exotic rules in a
160*2b949d04SAndroid Build Coastguard Worker      * separate file (e.g. `evdev.extras.xml`). Where the exotic rules are
161*2b949d04SAndroid Build Coastguard Worker      * requested, libxkbregistry will look for and load `$ruleset.extras.xml`
162*2b949d04SAndroid Build Coastguard Worker      * in the include paths, see rxkb_context_include_path_append() for details
163*2b949d04SAndroid Build Coastguard Worker      * on the lookup behavior.
164*2b949d04SAndroid Build Coastguard Worker      */
165*2b949d04SAndroid Build Coastguard Worker     RXKB_CONTEXT_LOAD_EXOTIC_RULES = (1 << 1),
166*2b949d04SAndroid Build Coastguard Worker };
167*2b949d04SAndroid Build Coastguard Worker 
168*2b949d04SAndroid Build Coastguard Worker /**
169*2b949d04SAndroid Build Coastguard Worker  * Create a new xkb registry context.
170*2b949d04SAndroid Build Coastguard Worker  *
171*2b949d04SAndroid Build Coastguard Worker  * The context has an initial refcount of 1. Use rxkb_context_unref() to release
172*2b949d04SAndroid Build Coastguard Worker  * memory associated with this context.
173*2b949d04SAndroid Build Coastguard Worker  *
174*2b949d04SAndroid Build Coastguard Worker  * Creating a context does not parse the files yet, use
175*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_parse().
176*2b949d04SAndroid Build Coastguard Worker  *
177*2b949d04SAndroid Build Coastguard Worker  * @param flags Flags affecting context behavior
178*2b949d04SAndroid Build Coastguard Worker  * @return A new xkb registry context or NULL on failure
179*2b949d04SAndroid Build Coastguard Worker  */
180*2b949d04SAndroid Build Coastguard Worker struct rxkb_context *
181*2b949d04SAndroid Build Coastguard Worker rxkb_context_new(enum rxkb_context_flags flags);
182*2b949d04SAndroid Build Coastguard Worker 
183*2b949d04SAndroid Build Coastguard Worker /** Specifies a logging level. */
184*2b949d04SAndroid Build Coastguard Worker enum rxkb_log_level {
185*2b949d04SAndroid Build Coastguard Worker     RXKB_LOG_LEVEL_CRITICAL = 10, /**< Log critical internal errors only. */
186*2b949d04SAndroid Build Coastguard Worker     RXKB_LOG_LEVEL_ERROR = 20,    /**< Log all errors. */
187*2b949d04SAndroid Build Coastguard Worker     RXKB_LOG_LEVEL_WARNING = 30,  /**< Log warnings and errors. */
188*2b949d04SAndroid Build Coastguard Worker     RXKB_LOG_LEVEL_INFO = 40,     /**< Log information, warnings, and errors. */
189*2b949d04SAndroid Build Coastguard Worker     RXKB_LOG_LEVEL_DEBUG = 50     /**< Log everything. */
190*2b949d04SAndroid Build Coastguard Worker };
191*2b949d04SAndroid Build Coastguard Worker 
192*2b949d04SAndroid Build Coastguard Worker /**
193*2b949d04SAndroid Build Coastguard Worker  * Set the current logging level.
194*2b949d04SAndroid Build Coastguard Worker  *
195*2b949d04SAndroid Build Coastguard Worker  * @param ctx     The context in which to set the logging level.
196*2b949d04SAndroid Build Coastguard Worker  * @param level   The logging level to use.  Only messages from this level
197*2b949d04SAndroid Build Coastguard Worker  * and below will be logged.
198*2b949d04SAndroid Build Coastguard Worker  *
199*2b949d04SAndroid Build Coastguard Worker  * The default level is RXKB_LOG_LEVEL_ERROR.  The environment variable
200*2b949d04SAndroid Build Coastguard Worker  * RXKB_LOG_LEVEL, if set at the time the context was created, overrides the
201*2b949d04SAndroid Build Coastguard Worker  * default value.  It may be specified as a level number or name.
202*2b949d04SAndroid Build Coastguard Worker  */
203*2b949d04SAndroid Build Coastguard Worker void
204*2b949d04SAndroid Build Coastguard Worker rxkb_context_set_log_level(struct rxkb_context *ctx,
205*2b949d04SAndroid Build Coastguard Worker                            enum rxkb_log_level level);
206*2b949d04SAndroid Build Coastguard Worker 
207*2b949d04SAndroid Build Coastguard Worker /**
208*2b949d04SAndroid Build Coastguard Worker  * Get the current logging level.
209*2b949d04SAndroid Build Coastguard Worker  */
210*2b949d04SAndroid Build Coastguard Worker enum rxkb_log_level
211*2b949d04SAndroid Build Coastguard Worker rxkb_context_get_log_level(struct rxkb_context *ctx);
212*2b949d04SAndroid Build Coastguard Worker 
213*2b949d04SAndroid Build Coastguard Worker /**
214*2b949d04SAndroid Build Coastguard Worker  * Set a custom function to handle logging messages.
215*2b949d04SAndroid Build Coastguard Worker  *
216*2b949d04SAndroid Build Coastguard Worker  * @param ctx     The context in which to use the set logging function.
217*2b949d04SAndroid Build Coastguard Worker  * @param log_fn  The function that will be called for logging messages.
218*2b949d04SAndroid Build Coastguard Worker  * Passing NULL restores the default function, which logs to stderr.
219*2b949d04SAndroid Build Coastguard Worker  *
220*2b949d04SAndroid Build Coastguard Worker  * By default, log messages from this library are printed to stderr.  This
221*2b949d04SAndroid Build Coastguard Worker  * function allows you to replace the default behavior with a custom
222*2b949d04SAndroid Build Coastguard Worker  * handler.  The handler is only called with messages which match the
223*2b949d04SAndroid Build Coastguard Worker  * current logging level and verbosity settings for the context.
224*2b949d04SAndroid Build Coastguard Worker  * level is the logging level of the message.  @a format and @a args are
225*2b949d04SAndroid Build Coastguard Worker  * the same as in the vprintf(3) function.
226*2b949d04SAndroid Build Coastguard Worker  *
227*2b949d04SAndroid Build Coastguard Worker  * You may use rxkb_context_set_user_data() on the context, and then call
228*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_get_user_data() from within the logging function to provide
229*2b949d04SAndroid Build Coastguard Worker  * it with additional private context.
230*2b949d04SAndroid Build Coastguard Worker  */
231*2b949d04SAndroid Build Coastguard Worker void
232*2b949d04SAndroid Build Coastguard Worker rxkb_context_set_log_fn(struct rxkb_context *ctx,
233*2b949d04SAndroid Build Coastguard Worker                         void (*log_fn)(struct rxkb_context *ctx,
234*2b949d04SAndroid Build Coastguard Worker                                        enum rxkb_log_level level,
235*2b949d04SAndroid Build Coastguard Worker                                        const char *format, va_list args));
236*2b949d04SAndroid Build Coastguard Worker 
237*2b949d04SAndroid Build Coastguard Worker 
238*2b949d04SAndroid Build Coastguard Worker /**
239*2b949d04SAndroid Build Coastguard Worker  * Parse the given ruleset. This can only be called once per context and once
240*2b949d04SAndroid Build Coastguard Worker  * parsed the data in the context is considered constant and will never
241*2b949d04SAndroid Build Coastguard Worker  * change.
242*2b949d04SAndroid Build Coastguard Worker  *
243*2b949d04SAndroid Build Coastguard Worker  * This function parses all files with the given ruleset name. See
244*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_include_path_append() for details.
245*2b949d04SAndroid Build Coastguard Worker  *
246*2b949d04SAndroid Build Coastguard Worker  * If this function returns false, libxkbregistry failed to parse the xml files.
247*2b949d04SAndroid Build Coastguard Worker  * This is usually caused by invalid files on the host and should be debugged by
248*2b949d04SAndroid Build Coastguard Worker  * the host's administrator using external tools. Callers should reduce the
249*2b949d04SAndroid Build Coastguard Worker  * include paths to known good paths and/or fall back to a default RMLVO set.
250*2b949d04SAndroid Build Coastguard Worker  *
251*2b949d04SAndroid Build Coastguard Worker  * If this function returns false, the context should be be considered dead and
252*2b949d04SAndroid Build Coastguard Worker  * must be released with rxkb_context_unref().
253*2b949d04SAndroid Build Coastguard Worker  *
254*2b949d04SAndroid Build Coastguard Worker  * @param ctx The xkb registry context
255*2b949d04SAndroid Build Coastguard Worker  * @param ruleset The ruleset to parse, e.g. "evdev"
256*2b949d04SAndroid Build Coastguard Worker  * @return true on success or false on failure
257*2b949d04SAndroid Build Coastguard Worker  */
258*2b949d04SAndroid Build Coastguard Worker bool
259*2b949d04SAndroid Build Coastguard Worker rxkb_context_parse(struct rxkb_context *ctx, const char *ruleset);
260*2b949d04SAndroid Build Coastguard Worker 
261*2b949d04SAndroid Build Coastguard Worker /**
262*2b949d04SAndroid Build Coastguard Worker  * Parse the default ruleset as configured at build time. See
263*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_parse() for details.
264*2b949d04SAndroid Build Coastguard Worker  */
265*2b949d04SAndroid Build Coastguard Worker bool
266*2b949d04SAndroid Build Coastguard Worker rxkb_context_parse_default_ruleset(struct rxkb_context *ctx);
267*2b949d04SAndroid Build Coastguard Worker 
268*2b949d04SAndroid Build Coastguard Worker /**
269*2b949d04SAndroid Build Coastguard Worker  * Increases the refcount of this object by one and returns the object.
270*2b949d04SAndroid Build Coastguard Worker  *
271*2b949d04SAndroid Build Coastguard Worker  * @param ctx The xkb registry context
272*2b949d04SAndroid Build Coastguard Worker  * @return The passed in object
273*2b949d04SAndroid Build Coastguard Worker  */
274*2b949d04SAndroid Build Coastguard Worker struct rxkb_context*
275*2b949d04SAndroid Build Coastguard Worker rxkb_context_ref(struct rxkb_context *ctx);
276*2b949d04SAndroid Build Coastguard Worker 
277*2b949d04SAndroid Build Coastguard Worker /**
278*2b949d04SAndroid Build Coastguard Worker  * Decreases the refcount of this object by one. Where the refcount of an
279*2b949d04SAndroid Build Coastguard Worker  * object hits zero, associated resources will be freed.
280*2b949d04SAndroid Build Coastguard Worker  *
281*2b949d04SAndroid Build Coastguard Worker  * @param ctx The xkb registry context
282*2b949d04SAndroid Build Coastguard Worker  * @return always NULL
283*2b949d04SAndroid Build Coastguard Worker  */
284*2b949d04SAndroid Build Coastguard Worker struct rxkb_context*
285*2b949d04SAndroid Build Coastguard Worker rxkb_context_unref(struct rxkb_context *ctx);
286*2b949d04SAndroid Build Coastguard Worker 
287*2b949d04SAndroid Build Coastguard Worker /**
288*2b949d04SAndroid Build Coastguard Worker  * Assign user-specific data. libxkbregistry will not look at or modify the
289*2b949d04SAndroid Build Coastguard Worker  * data, it will merely return the same pointer in
290*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_get_user_data().
291*2b949d04SAndroid Build Coastguard Worker  *
292*2b949d04SAndroid Build Coastguard Worker  * @param ctx The xkb registry context
293*2b949d04SAndroid Build Coastguard Worker  * @param user_data User-specific data pointer
294*2b949d04SAndroid Build Coastguard Worker  */
295*2b949d04SAndroid Build Coastguard Worker void
296*2b949d04SAndroid Build Coastguard Worker rxkb_context_set_user_data(struct rxkb_context *ctx, void *user_data);
297*2b949d04SAndroid Build Coastguard Worker 
298*2b949d04SAndroid Build Coastguard Worker /**
299*2b949d04SAndroid Build Coastguard Worker  * Return the pointer passed into rxkb_context_get_user_data().
300*2b949d04SAndroid Build Coastguard Worker  *
301*2b949d04SAndroid Build Coastguard Worker  * @param ctx The xkb registry context
302*2b949d04SAndroid Build Coastguard Worker  * @return User-specific data pointer
303*2b949d04SAndroid Build Coastguard Worker  */
304*2b949d04SAndroid Build Coastguard Worker void *
305*2b949d04SAndroid Build Coastguard Worker rxkb_context_get_user_data(struct rxkb_context *ctx);
306*2b949d04SAndroid Build Coastguard Worker 
307*2b949d04SAndroid Build Coastguard Worker /**
308*2b949d04SAndroid Build Coastguard Worker  * Append a new entry to the context's include path.
309*2b949d04SAndroid Build Coastguard Worker  *
310*2b949d04SAndroid Build Coastguard Worker  * The include path handling is optimized for the most common use-case: a set of
311*2b949d04SAndroid Build Coastguard Worker  * system files that provide a complete set of MLVO and some
312*2b949d04SAndroid Build Coastguard Worker  * custom MLVO provided by a user **in addition** to the system set.
313*2b949d04SAndroid Build Coastguard Worker  *
314*2b949d04SAndroid Build Coastguard Worker  * The include paths should be given so that the least complete path is
315*2b949d04SAndroid Build Coastguard Worker  * specified first and the most complete path is appended last. For example:
316*2b949d04SAndroid Build Coastguard Worker  *
317*2b949d04SAndroid Build Coastguard Worker  * @code
318*2b949d04SAndroid Build Coastguard Worker  *    ctx = rxkb_context_new(RXKB_CONTEXT_NO_DEFAULT_INCLUDES);
319*2b949d04SAndroid Build Coastguard Worker  *    rxkb_context_include_path_append(ctx, "/home/user/.config/xkb");
320*2b949d04SAndroid Build Coastguard Worker  *    rxkb_context_include_path_append(ctx, "/usr/share/X11/xkb");
321*2b949d04SAndroid Build Coastguard Worker  *    rxkb_context_parse(ctx, "evdev");
322*2b949d04SAndroid Build Coastguard Worker  * @endcode
323*2b949d04SAndroid Build Coastguard Worker  *
324*2b949d04SAndroid Build Coastguard Worker  * The above example reflects the default behavior unless @ref
325*2b949d04SAndroid Build Coastguard Worker  * RXKB_CONTEXT_NO_DEFAULT_INCLUDES is provided.
326*2b949d04SAndroid Build Coastguard Worker  *
327*2b949d04SAndroid Build Coastguard Worker  * Loading of the files is in **reverse order**, i.e. the last path appended is
328*2b949d04SAndroid Build Coastguard Worker  * loaded first - in this case the ``/usr/share/X11/xkb`` path.
329*2b949d04SAndroid Build Coastguard Worker  * Any models, layouts, variants and options defined in the "evdev" ruleset
330*2b949d04SAndroid Build Coastguard Worker  * are loaded into the context. Then, any RMLVO found in the "evdev" ruleset of
331*2b949d04SAndroid Build Coastguard Worker  * the user's path (``/home/user/.config/xkb`` in this example) are **appended**
332*2b949d04SAndroid Build Coastguard Worker  * to the existing set.
333*2b949d04SAndroid Build Coastguard Worker  *
334*2b949d04SAndroid Build Coastguard Worker  * Note that data from previously loaded include paths is never overwritten,
335*2b949d04SAndroid Build Coastguard Worker  * only appended to. It is not not possible to change the system-provided data,
336*2b949d04SAndroid Build Coastguard Worker  * only to append new models, layouts, variants and options to it.
337*2b949d04SAndroid Build Coastguard Worker  *
338*2b949d04SAndroid Build Coastguard Worker  * In other words, to define a new variant of the "us" layout called "banana",
339*2b949d04SAndroid Build Coastguard Worker  * the following XML is sufficient.
340*2b949d04SAndroid Build Coastguard Worker  *
341*2b949d04SAndroid Build Coastguard Worker  * @verbatim
342*2b949d04SAndroid Build Coastguard Worker  * <xkbConfigRegistry version="1.1">
343*2b949d04SAndroid Build Coastguard Worker  * <layoutList>
344*2b949d04SAndroid Build Coastguard Worker  *   <layout>
345*2b949d04SAndroid Build Coastguard Worker  *     <configItem>
346*2b949d04SAndroid Build Coastguard Worker  *       <name>us</name>
347*2b949d04SAndroid Build Coastguard Worker  *     </configItem>
348*2b949d04SAndroid Build Coastguard Worker  *     <variantList>
349*2b949d04SAndroid Build Coastguard Worker  *       <variant>
350*2b949d04SAndroid Build Coastguard Worker  *         <configItem>
351*2b949d04SAndroid Build Coastguard Worker  *          <name>banana</name>
352*2b949d04SAndroid Build Coastguard Worker  *          <description>English (Banana)</description>
353*2b949d04SAndroid Build Coastguard Worker  *        </configItem>
354*2b949d04SAndroid Build Coastguard Worker  *      </variant>
355*2b949d04SAndroid Build Coastguard Worker  *    </layout>
356*2b949d04SAndroid Build Coastguard Worker  * </layoutList>
357*2b949d04SAndroid Build Coastguard Worker  * </xkbConfigRegistry>
358*2b949d04SAndroid Build Coastguard Worker  * @endverbatim
359*2b949d04SAndroid Build Coastguard Worker  *
360*2b949d04SAndroid Build Coastguard Worker  * The list of models, options and all other layouts (including "us" and its
361*2b949d04SAndroid Build Coastguard Worker  * variants) is taken from the system files. The resulting list of layouts will
362*2b949d04SAndroid Build Coastguard Worker  * thus have a "us" keyboard layout with the variant "banana" and all other
363*2b949d04SAndroid Build Coastguard Worker  * system-provided variants (dvorak, colemak, intl, etc.)
364*2b949d04SAndroid Build Coastguard Worker  *
365*2b949d04SAndroid Build Coastguard Worker  * This function must be called before rxkb_context_parse() or
366*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_parse_default_ruleset().
367*2b949d04SAndroid Build Coastguard Worker  *
368*2b949d04SAndroid Build Coastguard Worker  * @returns true on success, or false if the include path could not be added
369*2b949d04SAndroid Build Coastguard Worker  * or is inaccessible.
370*2b949d04SAndroid Build Coastguard Worker  */
371*2b949d04SAndroid Build Coastguard Worker bool
372*2b949d04SAndroid Build Coastguard Worker rxkb_context_include_path_append(struct rxkb_context *ctx, const char *path);
373*2b949d04SAndroid Build Coastguard Worker 
374*2b949d04SAndroid Build Coastguard Worker /**
375*2b949d04SAndroid Build Coastguard Worker  * Append the default include paths to the context's include path.
376*2b949d04SAndroid Build Coastguard Worker  * See rxkb_context_include_path_append() for details about the merge order.
377*2b949d04SAndroid Build Coastguard Worker  *
378*2b949d04SAndroid Build Coastguard Worker  * This function must be called before rxkb_context_parse() or
379*2b949d04SAndroid Build Coastguard Worker  * rxkb_context_parse_default_ruleset().
380*2b949d04SAndroid Build Coastguard Worker  *
381*2b949d04SAndroid Build Coastguard Worker  * @returns true on success, or false if the include path could not be added
382*2b949d04SAndroid Build Coastguard Worker  * or is inaccessible.
383*2b949d04SAndroid Build Coastguard Worker  */
384*2b949d04SAndroid Build Coastguard Worker bool
385*2b949d04SAndroid Build Coastguard Worker rxkb_context_include_path_append_default(struct rxkb_context *ctx);
386*2b949d04SAndroid Build Coastguard Worker 
387*2b949d04SAndroid Build Coastguard Worker /**
388*2b949d04SAndroid Build Coastguard Worker  * Return the first model for this context. Use this to start iterating over
389*2b949d04SAndroid Build Coastguard Worker  * the models, followed by calls to rxkb_model_next(). Models are not sorted.
390*2b949d04SAndroid Build Coastguard Worker  *
391*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned model is not increased. Use rxkb_model_ref() if
392*2b949d04SAndroid Build Coastguard Worker  * you need to keep this struct outside the immediate scope.
393*2b949d04SAndroid Build Coastguard Worker  *
394*2b949d04SAndroid Build Coastguard Worker  * @return The first model in the model list.
395*2b949d04SAndroid Build Coastguard Worker  */
396*2b949d04SAndroid Build Coastguard Worker struct rxkb_model *
397*2b949d04SAndroid Build Coastguard Worker rxkb_model_first(struct rxkb_context *ctx);
398*2b949d04SAndroid Build Coastguard Worker 
399*2b949d04SAndroid Build Coastguard Worker /**
400*2b949d04SAndroid Build Coastguard Worker  * Return the next model for this context. Returns NULL when no more models
401*2b949d04SAndroid Build Coastguard Worker  * are available.
402*2b949d04SAndroid Build Coastguard Worker  *
403*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned model is not increased. Use rxkb_model_ref() if
404*2b949d04SAndroid Build Coastguard Worker  * you need to keep this struct outside the immediate scope.
405*2b949d04SAndroid Build Coastguard Worker  *
406*2b949d04SAndroid Build Coastguard Worker  * @return the next model or NULL at the end of the list
407*2b949d04SAndroid Build Coastguard Worker  */
408*2b949d04SAndroid Build Coastguard Worker struct rxkb_model *
409*2b949d04SAndroid Build Coastguard Worker rxkb_model_next(struct rxkb_model *m);
410*2b949d04SAndroid Build Coastguard Worker 
411*2b949d04SAndroid Build Coastguard Worker /**
412*2b949d04SAndroid Build Coastguard Worker  * Increase the refcount of the argument by one.
413*2b949d04SAndroid Build Coastguard Worker  *
414*2b949d04SAndroid Build Coastguard Worker  * @returns The argument passed in to this function.
415*2b949d04SAndroid Build Coastguard Worker  */
416*2b949d04SAndroid Build Coastguard Worker struct rxkb_model *
417*2b949d04SAndroid Build Coastguard Worker rxkb_model_ref(struct rxkb_model *m);
418*2b949d04SAndroid Build Coastguard Worker 
419*2b949d04SAndroid Build Coastguard Worker /**
420*2b949d04SAndroid Build Coastguard Worker  * Decrease the refcount of the argument by one. When the refcount hits zero,
421*2b949d04SAndroid Build Coastguard Worker  * all memory associated with this struct is freed.
422*2b949d04SAndroid Build Coastguard Worker  *
423*2b949d04SAndroid Build Coastguard Worker  * @returns always NULL
424*2b949d04SAndroid Build Coastguard Worker  */
425*2b949d04SAndroid Build Coastguard Worker struct rxkb_model *
426*2b949d04SAndroid Build Coastguard Worker rxkb_model_unref(struct rxkb_model *m);
427*2b949d04SAndroid Build Coastguard Worker 
428*2b949d04SAndroid Build Coastguard Worker /**
429*2b949d04SAndroid Build Coastguard Worker  * Return the name of this model. This is the value for M in RMLVO, to be used
430*2b949d04SAndroid Build Coastguard Worker  * with libxkbcommon.
431*2b949d04SAndroid Build Coastguard Worker  */
432*2b949d04SAndroid Build Coastguard Worker const char *
433*2b949d04SAndroid Build Coastguard Worker rxkb_model_get_name(struct rxkb_model *m);
434*2b949d04SAndroid Build Coastguard Worker 
435*2b949d04SAndroid Build Coastguard Worker /**
436*2b949d04SAndroid Build Coastguard Worker  * Return a human-readable description of this model. This function may return
437*2b949d04SAndroid Build Coastguard Worker  * NULL.
438*2b949d04SAndroid Build Coastguard Worker  */
439*2b949d04SAndroid Build Coastguard Worker const char *
440*2b949d04SAndroid Build Coastguard Worker rxkb_model_get_description(struct rxkb_model *m);
441*2b949d04SAndroid Build Coastguard Worker 
442*2b949d04SAndroid Build Coastguard Worker /**
443*2b949d04SAndroid Build Coastguard Worker  * Return the vendor name for this model. This function may return NULL.
444*2b949d04SAndroid Build Coastguard Worker  */
445*2b949d04SAndroid Build Coastguard Worker const char *
446*2b949d04SAndroid Build Coastguard Worker rxkb_model_get_vendor(struct rxkb_model *m);
447*2b949d04SAndroid Build Coastguard Worker 
448*2b949d04SAndroid Build Coastguard Worker /**
449*2b949d04SAndroid Build Coastguard Worker  * Return the popularity for this model.
450*2b949d04SAndroid Build Coastguard Worker  */
451*2b949d04SAndroid Build Coastguard Worker enum rxkb_popularity
452*2b949d04SAndroid Build Coastguard Worker rxkb_model_get_popularity(struct rxkb_model *m);
453*2b949d04SAndroid Build Coastguard Worker 
454*2b949d04SAndroid Build Coastguard Worker /**
455*2b949d04SAndroid Build Coastguard Worker  * Return the first layout for this context. Use this to start iterating over
456*2b949d04SAndroid Build Coastguard Worker  * the layouts, followed by calls to rxkb_layout_next(). Layouts are not sorted.
457*2b949d04SAndroid Build Coastguard Worker  *
458*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned layout is not increased. Use rxkb_layout_ref() if
459*2b949d04SAndroid Build Coastguard Worker  * you need to keep this struct outside the immediate scope.
460*2b949d04SAndroid Build Coastguard Worker  *
461*2b949d04SAndroid Build Coastguard Worker  * @return The first layout in the layout list.
462*2b949d04SAndroid Build Coastguard Worker  */
463*2b949d04SAndroid Build Coastguard Worker struct rxkb_layout *
464*2b949d04SAndroid Build Coastguard Worker rxkb_layout_first(struct rxkb_context *ctx);
465*2b949d04SAndroid Build Coastguard Worker 
466*2b949d04SAndroid Build Coastguard Worker /**
467*2b949d04SAndroid Build Coastguard Worker  * Return the next layout for this context. Returns NULL when no more layouts
468*2b949d04SAndroid Build Coastguard Worker  * are available.
469*2b949d04SAndroid Build Coastguard Worker  *
470*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned layout is not increased. Use rxkb_layout_ref()
471*2b949d04SAndroid Build Coastguard Worker  * if you need to keep this struct outside the immediate scope.
472*2b949d04SAndroid Build Coastguard Worker  *
473*2b949d04SAndroid Build Coastguard Worker  * @return the next layout or NULL at the end of the list
474*2b949d04SAndroid Build Coastguard Worker  */
475*2b949d04SAndroid Build Coastguard Worker struct rxkb_layout *
476*2b949d04SAndroid Build Coastguard Worker rxkb_layout_next(struct rxkb_layout *l);
477*2b949d04SAndroid Build Coastguard Worker 
478*2b949d04SAndroid Build Coastguard Worker /**
479*2b949d04SAndroid Build Coastguard Worker  * Increase the refcount of the argument by one.
480*2b949d04SAndroid Build Coastguard Worker  *
481*2b949d04SAndroid Build Coastguard Worker  * @returns The argument passed in to this function.
482*2b949d04SAndroid Build Coastguard Worker  */
483*2b949d04SAndroid Build Coastguard Worker struct rxkb_layout *
484*2b949d04SAndroid Build Coastguard Worker rxkb_layout_ref(struct rxkb_layout *l);
485*2b949d04SAndroid Build Coastguard Worker 
486*2b949d04SAndroid Build Coastguard Worker /**
487*2b949d04SAndroid Build Coastguard Worker  * Decrease the refcount of the argument by one. When the refcount hits zero,
488*2b949d04SAndroid Build Coastguard Worker  * all memory associated with this struct is freed.
489*2b949d04SAndroid Build Coastguard Worker  *
490*2b949d04SAndroid Build Coastguard Worker  * @returns always NULL
491*2b949d04SAndroid Build Coastguard Worker  */
492*2b949d04SAndroid Build Coastguard Worker struct rxkb_layout *
493*2b949d04SAndroid Build Coastguard Worker rxkb_layout_unref(struct rxkb_layout *l);
494*2b949d04SAndroid Build Coastguard Worker 
495*2b949d04SAndroid Build Coastguard Worker /**
496*2b949d04SAndroid Build Coastguard Worker  * Return the name of this layout. This is the value for L in RMLVO, to be used
497*2b949d04SAndroid Build Coastguard Worker  * with libxkbcommon.
498*2b949d04SAndroid Build Coastguard Worker  */
499*2b949d04SAndroid Build Coastguard Worker const char *
500*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_name(struct rxkb_layout *l);
501*2b949d04SAndroid Build Coastguard Worker 
502*2b949d04SAndroid Build Coastguard Worker /**
503*2b949d04SAndroid Build Coastguard Worker  * Return the variant of this layout. This is the value for V in RMLVO, to be
504*2b949d04SAndroid Build Coastguard Worker  * used with libxkbcommon.
505*2b949d04SAndroid Build Coastguard Worker  *
506*2b949d04SAndroid Build Coastguard Worker  * A variant does not stand on its own, it always depends on the base layout.
507*2b949d04SAndroid Build Coastguard Worker  * e.g. there may be multiple variants called "intl" but there is only one
508*2b949d04SAndroid Build Coastguard Worker  * "us(intl)".
509*2b949d04SAndroid Build Coastguard Worker  *
510*2b949d04SAndroid Build Coastguard Worker  * Where the variant is NULL, the layout is the base layout (e.g. "us").
511*2b949d04SAndroid Build Coastguard Worker  */
512*2b949d04SAndroid Build Coastguard Worker const char *
513*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_variant(struct rxkb_layout *l);
514*2b949d04SAndroid Build Coastguard Worker 
515*2b949d04SAndroid Build Coastguard Worker /**
516*2b949d04SAndroid Build Coastguard Worker  * Return a short (one-word) description of this layout. This function may
517*2b949d04SAndroid Build Coastguard Worker  * return NULL.
518*2b949d04SAndroid Build Coastguard Worker  */
519*2b949d04SAndroid Build Coastguard Worker const char *
520*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_brief(struct rxkb_layout *l);
521*2b949d04SAndroid Build Coastguard Worker 
522*2b949d04SAndroid Build Coastguard Worker /**
523*2b949d04SAndroid Build Coastguard Worker  * Return a human-readable description of this layout. This function may return
524*2b949d04SAndroid Build Coastguard Worker  * NULL.
525*2b949d04SAndroid Build Coastguard Worker  */
526*2b949d04SAndroid Build Coastguard Worker const char *
527*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_description(struct rxkb_layout *l);
528*2b949d04SAndroid Build Coastguard Worker 
529*2b949d04SAndroid Build Coastguard Worker /**
530*2b949d04SAndroid Build Coastguard Worker  * Return the popularity for this layout.
531*2b949d04SAndroid Build Coastguard Worker  */
532*2b949d04SAndroid Build Coastguard Worker enum rxkb_popularity
533*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_popularity(struct rxkb_layout *l);
534*2b949d04SAndroid Build Coastguard Worker 
535*2b949d04SAndroid Build Coastguard Worker /**
536*2b949d04SAndroid Build Coastguard Worker  * Return the first option group for this context. Use this to start iterating
537*2b949d04SAndroid Build Coastguard Worker  * over the option groups, followed by calls to rxkb_option_group_next().
538*2b949d04SAndroid Build Coastguard Worker  * Option groups are not sorted.
539*2b949d04SAndroid Build Coastguard Worker  *
540*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned option group is not increased. Use
541*2b949d04SAndroid Build Coastguard Worker  * rxkb_option_group_ref() if you need to keep this struct outside the immediate
542*2b949d04SAndroid Build Coastguard Worker  * scope.
543*2b949d04SAndroid Build Coastguard Worker  *
544*2b949d04SAndroid Build Coastguard Worker  * @return The first option group in the option group list.
545*2b949d04SAndroid Build Coastguard Worker  */
546*2b949d04SAndroid Build Coastguard Worker struct rxkb_option_group *
547*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_first(struct rxkb_context *ctx);
548*2b949d04SAndroid Build Coastguard Worker 
549*2b949d04SAndroid Build Coastguard Worker /**
550*2b949d04SAndroid Build Coastguard Worker  * Return the next option group for this context. Returns NULL when no more
551*2b949d04SAndroid Build Coastguard Worker  * option groups are available.
552*2b949d04SAndroid Build Coastguard Worker  *
553*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned option group is not increased. Use
554*2b949d04SAndroid Build Coastguard Worker  * rxkb_option_group_ref() if you need to keep this struct outside the immediate
555*2b949d04SAndroid Build Coastguard Worker  * scope.
556*2b949d04SAndroid Build Coastguard Worker  *
557*2b949d04SAndroid Build Coastguard Worker  * @return the next option group or NULL at the end of the list
558*2b949d04SAndroid Build Coastguard Worker  */
559*2b949d04SAndroid Build Coastguard Worker struct rxkb_option_group *
560*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_next(struct rxkb_option_group *g);
561*2b949d04SAndroid Build Coastguard Worker 
562*2b949d04SAndroid Build Coastguard Worker /**
563*2b949d04SAndroid Build Coastguard Worker  * Increase the refcount of the argument by one.
564*2b949d04SAndroid Build Coastguard Worker  *
565*2b949d04SAndroid Build Coastguard Worker  * @returns The argument passed in to this function.
566*2b949d04SAndroid Build Coastguard Worker  */
567*2b949d04SAndroid Build Coastguard Worker struct rxkb_option_group *
568*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_ref(struct rxkb_option_group *g);
569*2b949d04SAndroid Build Coastguard Worker 
570*2b949d04SAndroid Build Coastguard Worker /**
571*2b949d04SAndroid Build Coastguard Worker  * Decrease the refcount of the argument by one. When the refcount hits zero,
572*2b949d04SAndroid Build Coastguard Worker  * all memory associated with this struct is freed.
573*2b949d04SAndroid Build Coastguard Worker  *
574*2b949d04SAndroid Build Coastguard Worker  * @returns always NULL
575*2b949d04SAndroid Build Coastguard Worker  */
576*2b949d04SAndroid Build Coastguard Worker struct rxkb_option_group *
577*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_unref(struct rxkb_option_group *g);
578*2b949d04SAndroid Build Coastguard Worker 
579*2b949d04SAndroid Build Coastguard Worker /**
580*2b949d04SAndroid Build Coastguard Worker  * Return the name of this option group. This is **not** the value for O in
581*2b949d04SAndroid Build Coastguard Worker  * RMLVO, the name can be used for internal sorting in the caller. This function
582*2b949d04SAndroid Build Coastguard Worker  * may return NULL.
583*2b949d04SAndroid Build Coastguard Worker  */
584*2b949d04SAndroid Build Coastguard Worker const char *
585*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_get_name(struct rxkb_option_group *m);
586*2b949d04SAndroid Build Coastguard Worker 
587*2b949d04SAndroid Build Coastguard Worker /**
588*2b949d04SAndroid Build Coastguard Worker  * Return a human-readable description of this option group. This function may
589*2b949d04SAndroid Build Coastguard Worker  * return NULL.
590*2b949d04SAndroid Build Coastguard Worker  */
591*2b949d04SAndroid Build Coastguard Worker const char *
592*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_get_description(struct rxkb_option_group *m);
593*2b949d04SAndroid Build Coastguard Worker 
594*2b949d04SAndroid Build Coastguard Worker /**
595*2b949d04SAndroid Build Coastguard Worker  * @return true if multiple options within this option group can be selected
596*2b949d04SAndroid Build Coastguard Worker  *              simultaneously, false if all options within this option group
597*2b949d04SAndroid Build Coastguard Worker  *              are mutually exclusive.
598*2b949d04SAndroid Build Coastguard Worker  */
599*2b949d04SAndroid Build Coastguard Worker bool
600*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_allows_multiple(struct rxkb_option_group *g);
601*2b949d04SAndroid Build Coastguard Worker 
602*2b949d04SAndroid Build Coastguard Worker /**
603*2b949d04SAndroid Build Coastguard Worker  * Return the popularity for this option group.
604*2b949d04SAndroid Build Coastguard Worker  */
605*2b949d04SAndroid Build Coastguard Worker enum rxkb_popularity
606*2b949d04SAndroid Build Coastguard Worker rxkb_option_group_get_popularity(struct rxkb_option_group *g);
607*2b949d04SAndroid Build Coastguard Worker 
608*2b949d04SAndroid Build Coastguard Worker /**
609*2b949d04SAndroid Build Coastguard Worker  * Return the first option for this option group. Use this to start iterating
610*2b949d04SAndroid Build Coastguard Worker  * over the options, followed by calls to rxkb_option_next(). Options are not
611*2b949d04SAndroid Build Coastguard Worker  * sorted.
612*2b949d04SAndroid Build Coastguard Worker  *
613*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned option is not increased. Use rxkb_option_ref()
614*2b949d04SAndroid Build Coastguard Worker  * if you need to keep this struct outside the immediate scope.
615*2b949d04SAndroid Build Coastguard Worker  *
616*2b949d04SAndroid Build Coastguard Worker  * @return The first option in the option list.
617*2b949d04SAndroid Build Coastguard Worker  */
618*2b949d04SAndroid Build Coastguard Worker struct rxkb_option *
619*2b949d04SAndroid Build Coastguard Worker rxkb_option_first(struct rxkb_option_group *group);
620*2b949d04SAndroid Build Coastguard Worker 
621*2b949d04SAndroid Build Coastguard Worker /**
622*2b949d04SAndroid Build Coastguard Worker  * Return the next option for this option group. Returns NULL when no more
623*2b949d04SAndroid Build Coastguard Worker  * options are available.
624*2b949d04SAndroid Build Coastguard Worker  *
625*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned options is not increased. Use rxkb_option_ref()
626*2b949d04SAndroid Build Coastguard Worker  * if you need to keep this struct outside the immediate scope.
627*2b949d04SAndroid Build Coastguard Worker  *
628*2b949d04SAndroid Build Coastguard Worker  * @returns The next option or NULL at the end of the list
629*2b949d04SAndroid Build Coastguard Worker  */
630*2b949d04SAndroid Build Coastguard Worker struct rxkb_option *
631*2b949d04SAndroid Build Coastguard Worker rxkb_option_next(struct rxkb_option *o);
632*2b949d04SAndroid Build Coastguard Worker 
633*2b949d04SAndroid Build Coastguard Worker /**
634*2b949d04SAndroid Build Coastguard Worker  * Increase the refcount of the argument by one.
635*2b949d04SAndroid Build Coastguard Worker  *
636*2b949d04SAndroid Build Coastguard Worker  * @returns The argument passed in to this function.
637*2b949d04SAndroid Build Coastguard Worker  */
638*2b949d04SAndroid Build Coastguard Worker struct rxkb_option *
639*2b949d04SAndroid Build Coastguard Worker rxkb_option_ref(struct rxkb_option *o);
640*2b949d04SAndroid Build Coastguard Worker 
641*2b949d04SAndroid Build Coastguard Worker /**
642*2b949d04SAndroid Build Coastguard Worker  * Decrease the refcount of the argument by one. When the refcount hits zero,
643*2b949d04SAndroid Build Coastguard Worker  * all memory associated with this struct is freed.
644*2b949d04SAndroid Build Coastguard Worker  *
645*2b949d04SAndroid Build Coastguard Worker  * @returns always NULL
646*2b949d04SAndroid Build Coastguard Worker  */
647*2b949d04SAndroid Build Coastguard Worker struct rxkb_option *
648*2b949d04SAndroid Build Coastguard Worker rxkb_option_unref(struct rxkb_option *o);
649*2b949d04SAndroid Build Coastguard Worker 
650*2b949d04SAndroid Build Coastguard Worker /**
651*2b949d04SAndroid Build Coastguard Worker  * Return the name of this option. This is the value for O in RMLVO, to be used
652*2b949d04SAndroid Build Coastguard Worker  * with libxkbcommon.
653*2b949d04SAndroid Build Coastguard Worker  */
654*2b949d04SAndroid Build Coastguard Worker const char *
655*2b949d04SAndroid Build Coastguard Worker rxkb_option_get_name(struct rxkb_option *o);
656*2b949d04SAndroid Build Coastguard Worker 
657*2b949d04SAndroid Build Coastguard Worker /**
658*2b949d04SAndroid Build Coastguard Worker  * Return a short (one-word) description of this option. This function may
659*2b949d04SAndroid Build Coastguard Worker  * return NULL.
660*2b949d04SAndroid Build Coastguard Worker  */
661*2b949d04SAndroid Build Coastguard Worker const char *
662*2b949d04SAndroid Build Coastguard Worker rxkb_option_get_brief(struct rxkb_option *o);
663*2b949d04SAndroid Build Coastguard Worker 
664*2b949d04SAndroid Build Coastguard Worker /**
665*2b949d04SAndroid Build Coastguard Worker  * Return a human-readable description of this option. This function may return
666*2b949d04SAndroid Build Coastguard Worker  * NULL.
667*2b949d04SAndroid Build Coastguard Worker  */
668*2b949d04SAndroid Build Coastguard Worker const char *
669*2b949d04SAndroid Build Coastguard Worker rxkb_option_get_description(struct rxkb_option *o);
670*2b949d04SAndroid Build Coastguard Worker 
671*2b949d04SAndroid Build Coastguard Worker /**
672*2b949d04SAndroid Build Coastguard Worker  * Return the popularity for this option.
673*2b949d04SAndroid Build Coastguard Worker  */
674*2b949d04SAndroid Build Coastguard Worker enum rxkb_popularity
675*2b949d04SAndroid Build Coastguard Worker rxkb_option_get_popularity(struct rxkb_option *o);
676*2b949d04SAndroid Build Coastguard Worker 
677*2b949d04SAndroid Build Coastguard Worker /**
678*2b949d04SAndroid Build Coastguard Worker  * Increase the refcount of the argument by one.
679*2b949d04SAndroid Build Coastguard Worker  *
680*2b949d04SAndroid Build Coastguard Worker  * @returns The argument passed in to this function.
681*2b949d04SAndroid Build Coastguard Worker  */
682*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso639_code *
683*2b949d04SAndroid Build Coastguard Worker rxkb_iso639_code_ref(struct rxkb_iso639_code *iso639);
684*2b949d04SAndroid Build Coastguard Worker 
685*2b949d04SAndroid Build Coastguard Worker /**
686*2b949d04SAndroid Build Coastguard Worker  * Decrease the refcount of the argument by one. When the refcount hits zero,
687*2b949d04SAndroid Build Coastguard Worker  * all memory associated with this struct is freed.
688*2b949d04SAndroid Build Coastguard Worker  *
689*2b949d04SAndroid Build Coastguard Worker  * @returns always NULL
690*2b949d04SAndroid Build Coastguard Worker  */
691*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso639_code *
692*2b949d04SAndroid Build Coastguard Worker rxkb_iso639_code_unref(struct rxkb_iso639_code *iso639);
693*2b949d04SAndroid Build Coastguard Worker 
694*2b949d04SAndroid Build Coastguard Worker /**
695*2b949d04SAndroid Build Coastguard Worker  * Return the ISO 639-3 code for this code (e.g. "eng", "fra").
696*2b949d04SAndroid Build Coastguard Worker  */
697*2b949d04SAndroid Build Coastguard Worker const char *
698*2b949d04SAndroid Build Coastguard Worker rxkb_iso639_code_get_code(struct rxkb_iso639_code *iso639);
699*2b949d04SAndroid Build Coastguard Worker 
700*2b949d04SAndroid Build Coastguard Worker /**
701*2b949d04SAndroid Build Coastguard Worker  * Return the first ISO 639 for this layout. Use this to start iterating over
702*2b949d04SAndroid Build Coastguard Worker  * the codes, followed by calls to rxkb_iso639_code_next(). Codes are not
703*2b949d04SAndroid Build Coastguard Worker  * sorted.
704*2b949d04SAndroid Build Coastguard Worker  *
705*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned code is not increased. Use rxkb_iso639_code_ref()
706*2b949d04SAndroid Build Coastguard Worker  * if you need to keep this struct outside the immediate scope.
707*2b949d04SAndroid Build Coastguard Worker  *
708*2b949d04SAndroid Build Coastguard Worker  * @return The first code in the code list.
709*2b949d04SAndroid Build Coastguard Worker  */
710*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso639_code *
711*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_iso639_first(struct rxkb_layout *layout);
712*2b949d04SAndroid Build Coastguard Worker 
713*2b949d04SAndroid Build Coastguard Worker /**
714*2b949d04SAndroid Build Coastguard Worker  * Return the next code in the list. Returns NULL when no more codes
715*2b949d04SAndroid Build Coastguard Worker  * are available.
716*2b949d04SAndroid Build Coastguard Worker  *
717*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned codes is not increased. Use
718*2b949d04SAndroid Build Coastguard Worker  * rxkb_iso639_code_ref() if you need to keep this struct outside the immediate
719*2b949d04SAndroid Build Coastguard Worker  * scope.
720*2b949d04SAndroid Build Coastguard Worker  *
721*2b949d04SAndroid Build Coastguard Worker  * @returns The next code or NULL at the end of the list
722*2b949d04SAndroid Build Coastguard Worker  */
723*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso639_code *
724*2b949d04SAndroid Build Coastguard Worker rxkb_iso639_code_next(struct rxkb_iso639_code *iso639);
725*2b949d04SAndroid Build Coastguard Worker 
726*2b949d04SAndroid Build Coastguard Worker /**
727*2b949d04SAndroid Build Coastguard Worker  * Increase the refcount of the argument by one.
728*2b949d04SAndroid Build Coastguard Worker  *
729*2b949d04SAndroid Build Coastguard Worker  * @returns The argument passed in to this function.
730*2b949d04SAndroid Build Coastguard Worker  */
731*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso3166_code *
732*2b949d04SAndroid Build Coastguard Worker rxkb_iso3166_code_ref(struct rxkb_iso3166_code *iso3166);
733*2b949d04SAndroid Build Coastguard Worker 
734*2b949d04SAndroid Build Coastguard Worker /**
735*2b949d04SAndroid Build Coastguard Worker  * Decrease the refcount of the argument by one. When the refcount hits zero,
736*2b949d04SAndroid Build Coastguard Worker  * all memory associated with this struct is freed.
737*2b949d04SAndroid Build Coastguard Worker  *
738*2b949d04SAndroid Build Coastguard Worker  * @returns always NULL
739*2b949d04SAndroid Build Coastguard Worker  */
740*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso3166_code *
741*2b949d04SAndroid Build Coastguard Worker rxkb_iso3166_code_unref(struct rxkb_iso3166_code *iso3166);
742*2b949d04SAndroid Build Coastguard Worker 
743*2b949d04SAndroid Build Coastguard Worker /**
744*2b949d04SAndroid Build Coastguard Worker  * Return the ISO 3166 Alpha 2 code for this code (e.g. "US", "FR").
745*2b949d04SAndroid Build Coastguard Worker  */
746*2b949d04SAndroid Build Coastguard Worker const char *
747*2b949d04SAndroid Build Coastguard Worker rxkb_iso3166_code_get_code(struct rxkb_iso3166_code *iso3166);
748*2b949d04SAndroid Build Coastguard Worker 
749*2b949d04SAndroid Build Coastguard Worker /**
750*2b949d04SAndroid Build Coastguard Worker  * Return the first ISO 3166 for this layout. Use this to start iterating over
751*2b949d04SAndroid Build Coastguard Worker  * the codes, followed by calls to rxkb_iso3166_code_next(). Codes are not
752*2b949d04SAndroid Build Coastguard Worker  * sorted.
753*2b949d04SAndroid Build Coastguard Worker  *
754*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned code is not increased. Use
755*2b949d04SAndroid Build Coastguard Worker  * rxkb_iso3166_code_ref() if you need to keep this struct outside the immediate
756*2b949d04SAndroid Build Coastguard Worker  * scope.
757*2b949d04SAndroid Build Coastguard Worker  *
758*2b949d04SAndroid Build Coastguard Worker  * @return The first code in the code list.
759*2b949d04SAndroid Build Coastguard Worker  */
760*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso3166_code *
761*2b949d04SAndroid Build Coastguard Worker rxkb_layout_get_iso3166_first(struct rxkb_layout *layout);
762*2b949d04SAndroid Build Coastguard Worker 
763*2b949d04SAndroid Build Coastguard Worker /**
764*2b949d04SAndroid Build Coastguard Worker  * Return the next code in the list. Returns NULL when no more codes
765*2b949d04SAndroid Build Coastguard Worker  * are available.
766*2b949d04SAndroid Build Coastguard Worker  *
767*2b949d04SAndroid Build Coastguard Worker  * The refcount of the returned codes is not increased. Use
768*2b949d04SAndroid Build Coastguard Worker  * rxkb_iso3166_code_ref() if you need to keep this struct outside the immediate
769*2b949d04SAndroid Build Coastguard Worker  * scope.
770*2b949d04SAndroid Build Coastguard Worker  *
771*2b949d04SAndroid Build Coastguard Worker  * @returns The next code or NULL at the end of the list
772*2b949d04SAndroid Build Coastguard Worker  */
773*2b949d04SAndroid Build Coastguard Worker struct rxkb_iso3166_code *
774*2b949d04SAndroid Build Coastguard Worker rxkb_iso3166_code_next(struct rxkb_iso3166_code *iso3166);
775*2b949d04SAndroid Build Coastguard Worker 
776*2b949d04SAndroid Build Coastguard Worker /** @} */
777*2b949d04SAndroid Build Coastguard Worker 
778*2b949d04SAndroid Build Coastguard Worker #ifdef __cplusplus
779*2b949d04SAndroid Build Coastguard Worker } /* extern "C" */
780*2b949d04SAndroid Build Coastguard Worker #endif
781*2b949d04SAndroid Build Coastguard Worker 
782*2b949d04SAndroid Build Coastguard Worker #endif /* _XKBREGISTRY_H_ */
783