tools: avoid use of a private api This is merely to fill in some NULL pointers anyway, we can just use the #defines we have available at build time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/tools/compile-keymap.c b/tools/compile-keymap.c
index 9458f6a..be2eaeb 100644
--- a/tools/compile-keymap.c
+++ b/tools/compile-keymap.c
@@ -290,11 +290,13 @@ main(int argc, char **argv)
{
struct xkb_context *ctx;
struct xkb_rule_names names = {
- .rules = NULL,
- .model = NULL,
+ .rules = DEFAULT_XKB_RULES,
+ .model = DEFAULT_XKB_MODEL,
+ /* layout and variant are tied together, so we either get user-supplied for
+ * both or default for both, see below */
.layout = NULL,
.variant = NULL,
- .options = NULL,
+ .options = DEFAULT_XKB_OPTIONS,
};
int rc = 1;
const char **path;
@@ -307,6 +309,16 @@ main(int argc, char **argv)
if (!parse_options(argc, argv, &names))
return EXIT_INVALID_USAGE;
+ /* Now fill in the layout */
+ if (isempty(names.layout)) {
+ if (!isempty(names.variant)) {
+ fprintf(stderr, "Error: a variant requires a layout\n");
+ return EXIT_INVALID_USAGE;
+ }
+ names.layout = DEFAULT_XKB_LAYOUT;
+ names.variant = DEFAULT_XKB_VARIANT;
+ }
+
ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES);
assert(ctx);
@@ -315,7 +327,6 @@ main(int argc, char **argv)
xkb_context_set_log_verbosity(ctx, 10);
}
- xkb_context_sanitize_rule_names(ctx, &names);
if (darray_empty(includes))
darray_append(includes, DEFAULT_INCLUDE_PATH_PLACEHOLDER);