From 990c09a3d096b29f3de026dc92b36edf1ccf0574 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 28 Jul 2013 16:21:40 +0300 Subject: [PATCH] keymap: update builtin fields directly in src/keymap.c This fields are part of our API and every keymap should have them, not just xkbcomp/ ones. Signed-off-by: Ran Benita --- src/keymap.c | 22 ++++++++++++++++++++++ src/xkbcomp/keymap.c | 25 ------------------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/keymap.c b/src/keymap.c index f8efd7b..4cb01c6 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -53,6 +53,26 @@ #include "keymap.h" #include "text.h" +static void +update_builtin_keymap_fields(struct xkb_keymap *keymap) +{ + struct xkb_context *ctx = keymap->ctx; + + /* + * Add predefined (AKA real, core, X11) modifiers. + * The order is important! + */ + darray_appends_t(keymap->mods, struct xkb_mod, + { .name = xkb_atom_intern_literal(ctx, "Shift"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Lock"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Control"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Mod1"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Mod2"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Mod3"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Mod4"), .type = MOD_REAL }, + { .name = xkb_atom_intern_literal(ctx, "Mod5"), .type = MOD_REAL }); +} + static struct xkb_keymap * xkb_keymap_new(struct xkb_context *ctx, enum xkb_keymap_format format, @@ -70,6 +90,8 @@ xkb_keymap_new(struct xkb_context *ctx, keymap->format = format; keymap->flags = flags; + update_builtin_keymap_fields(keymap); + return keymap; } diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index d9dd0f6..549cf05 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -225,28 +225,6 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap) return true; } -static bool -UpdateBuiltinKeymapFields(struct xkb_keymap *keymap) -{ - struct xkb_context *ctx = keymap->ctx; - - /* - * Add predefined (AKA real, core, X11) modifiers. - * The order is important! - */ - darray_appends_t(keymap->mods, struct xkb_mod, - { .name = xkb_atom_intern_literal(ctx, "Shift"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Lock"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Control"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Mod1"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Mod2"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Mod3"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Mod4"), .type = MOD_REAL }, - { .name = xkb_atom_intern_literal(ctx, "Mod5"), .type = MOD_REAL }); - - return true; -} - typedef bool (*compile_file_fn)(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge); @@ -312,9 +290,6 @@ CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) if (!ok) return false; - if (!UpdateBuiltinKeymapFields(keymap)) - return false; - /* Compile sections. */ for (type = FIRST_KEYMAP_FILE_TYPE; type <= LAST_KEYMAP_FILE_TYPE;