diff options
author | Ran Benita <ran234@gmail.com> | 2013-02-08 13:09:33 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2014-04-19 16:20:09 +0300 |
commit | ca3170ad3813389a3325513130c37e8038fa02f9 (patch) | |
tree | f743e6b3f056bcdcfab7f8b029a03c9818cb2dd7 /src/xkbcomp | |
parent | 3d7aff5fcdad501856662e6b84a76ef883b35784 (diff) | |
download | libxkbcommon-ca3170ad3813389a3325513130c37e8038fa02f9.tar.gz libxkbcommon-ca3170ad3813389a3325513130c37e8038fa02f9.tar.bz2 libxkbcommon-ca3170ad3813389a3325513130c37e8038fa02f9.zip |
Add struct xkb_mod_set
The only thing that the compilation phase needs the keymap for currently
is for access to the modifier information (it also modifies it in
place!). We want to only pass along the neccessary information, to make
it more tractable and testable, so instead of passing the entire keymap
we add a new 'mod_set' object and pass a (const) reference to that.
The new object is just the old array of 'struct xkb_mod'.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp')
-rw-r--r-- | src/xkbcomp/keymap-dump.c | 4 | ||||
-rw-r--r-- | src/xkbcomp/keymap.c | 4 | ||||
-rw-r--r-- | src/xkbcomp/vmod.c | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c index 7f70ca3..9e3f3e8 100644 --- a/src/xkbcomp/keymap-dump.c +++ b/src/xkbcomp/keymap-dump.c @@ -126,7 +126,7 @@ write_vmods(struct xkb_keymap *keymap, struct buf *buf) const struct xkb_mod *mod; xkb_mod_index_t num_vmods = 0; - darray_foreach(mod, keymap->mods) { + darray_foreach(mod, keymap->mods.mods) { if (mod->type != MOD_VIRT) continue; @@ -621,7 +621,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) if (key->modmap == 0) continue; - darray_enumerate(i, mod, keymap->mods) + darray_enumerate(i, mod, keymap->mods.mods) if (key->modmap & (1u << i)) write_buf(buf, "\tmodifier_map %s { %s };\n", xkb_atom_text(keymap->ctx, mod->name), diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index 8a70577..3e067f7 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -38,7 +38,7 @@ ComputeEffectiveMask(struct xkb_keymap *keymap, struct xkb_mods *mods) /* The effective mask is only real mods for now. */ mods->mask = mods->mods & MOD_REAL_MASK_ALL; - darray_enumerate(i, mod, keymap->mods) + darray_enumerate(i, mod, keymap->mods.mods) if (mods->mods & (1u << i)) mods->mask |= mod->mapping; } @@ -193,7 +193,7 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap) /* Update keymap->mods, the virtual -> real mod mapping. */ xkb_foreach_key(key, keymap) - darray_enumerate(i, mod, keymap->mods) + darray_enumerate(i, mod, keymap->mods.mods) if (key->vmodmap & (1u << i)) mod->mapping |= key->modmap; diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c index 86e7bec..95b86bd 100644 --- a/src/xkbcomp/vmod.c +++ b/src/xkbcomp/vmod.c @@ -57,7 +57,7 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, mapping = 0; } - darray_enumerate(i, mod, keymap->mods) { + darray_enumerate(i, mod, keymap->mods.mods) { if (mod->name == stmt->name) { if (mod->type != MOD_VIRT) { log_err(keymap->ctx, @@ -91,7 +91,7 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, } } - if (darray_size(keymap->mods) >= XKB_MAX_MODS) { + if (darray_size(keymap->mods.mods) >= XKB_MAX_MODS) { log_err(keymap->ctx, "Too many modifiers defined (maximum %d)\n", XKB_MAX_MODS); @@ -101,6 +101,6 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, new.name = stmt->name; new.mapping = mapping; new.type = MOD_VIRT; - darray_append(keymap->mods, new); + darray_append(keymap->mods.mods, new); return true; } |