summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-07-24 13:25:11 +1000
committerRan Benita <ran@unusedvar.com>2020-07-25 11:05:14 +0300
commita472e030ea72c6f901dfec572ccbecb5b1b1f3d6 (patch)
tree56fce0fc880fa3af7642f003de6646ad84280ff9 /tools
parentcd119a2824910cdc82a0186d90f105f48e1539d5 (diff)
downloadxorg-lib-libxkbcommon-a472e030ea72c6f901dfec572ccbecb5b1b1f3d6.tar.gz
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/compile-keymap.c19
1 files changed, 15 insertions, 4 deletions
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);