#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,
keymap->format = format;
keymap->flags = flags;
+ update_builtin_keymap_fields(keymap);
+
return 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);
if (!ok)
return false;
- if (!UpdateBuiltinKeymapFields(keymap))
- return false;
-
/* Compile sections. */
for (type = FIRST_KEYMAP_FILE_TYPE;
type <= LAST_KEYMAP_FILE_TYPE;