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 <ran234@gmail.com>master
parent
5f787e5e91
commit
990c09a3d0
22
src/keymap.c
22
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue