diff options
author | Ran Benita <ran234@gmail.com> | 2012-09-24 14:57:30 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-09-24 14:57:30 +0200 |
commit | 5d2659267aba6bddc8fd44306262720965007846 (patch) | |
tree | ec7f6599fe7149a42025b718747b875afc2e5862 /src | |
parent | c955f8e2f9a915e3b7bced6f9b0c2b864f31e8ef (diff) |
keymap: remove some more unneeded macros
It clearer to just access the needed data directly.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/keymap-dump.c | 2 | ||||
-rw-r--r-- | src/keymap.c | 8 | ||||
-rw-r--r-- | src/keymap.h | 24 | ||||
-rw-r--r-- | src/state.c | 2 | ||||
-rw-r--r-- | src/xkbcomp/symbols.c | 7 |
5 files changed, 11 insertions, 32 deletions
diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 695c3be..d2f9774 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -717,7 +717,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) if (level != 0) write_buf(buf, ", "); write_action(keymap, buf, - XkbKeyActionEntry(key, group, level), + &key->groups[group].levels[level].action, NULL, NULL); } write_buf(buf, " ]"); diff --git a/src/keymap.c b/src/keymap.c index 77afda7..bc2632f 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -321,11 +321,15 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap, if (level >= XkbKeyGroupWidth(key, layout)) goto err; - num_syms = XkbKeyNumSyms(key, layout, level); + num_syms = key->groups[layout].levels[level].num_syms; if (num_syms == 0) goto err; - *syms_out = XkbKeySymEntry(key, layout, level); + if (num_syms == 1) + *syms_out = &key->groups[layout].levels[level].u.sym; + else + *syms_out = key->groups[layout].levels[level].u.syms; + return num_syms; err: diff --git a/src/keymap.h b/src/keymap.h index 0829c39..014ad72 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -413,30 +413,6 @@ XkbKeyGroupWidth(const struct xkb_key *key, xkb_layout_index_t layout) return key->groups[layout].type->num_levels; } -static inline unsigned int -XkbKeyNumSyms(const struct xkb_key *key, xkb_layout_index_t layout, - xkb_level_index_t level) -{ - return key->groups[layout].levels[level].num_syms; -} - -static inline const xkb_keysym_t * -XkbKeySymEntry(const struct xkb_key *key, xkb_layout_index_t layout, - xkb_level_index_t level) -{ - if (XkbKeyNumSyms(key, layout, level) <= 1) - return &key->groups[layout].levels[level].u.sym; - else - return key->groups[layout].levels[level].u.syms; -} - -static inline const union xkb_action * -XkbKeyActionEntry(const struct xkb_key *key, xkb_layout_index_t layout, - xkb_level_index_t level) -{ - return &key->groups[layout].levels[level].action; -} - struct xkb_keymap * xkb_keymap_new(struct xkb_context *ctx, enum xkb_keymap_format format, diff --git a/src/state.c b/src/state.c index 0210d38..9fa57ff 100644 --- a/src/state.c +++ b/src/state.c @@ -218,7 +218,7 @@ xkb_key_get_action(struct xkb_state *state, const struct xkb_key *key) if (level == XKB_LEVEL_INVALID) return &fake; - return XkbKeyActionEntry(key, layout, level); + return &key->groups[layout].levels[level].action; } static struct xkb_filter * diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 13c0887..9a96487 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -1308,10 +1308,9 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) xkb_foreach_key(key, keymap) { for (group = 0; group < key->num_groups; group++) { - for (level = 0; level < XkbKeyGroupWidth(key, group); - level++) { - if (XkbKeyNumSyms(key, group, level) != 1 || - (XkbKeySymEntry(key, group, level))[0] != sym) + for (level = 0; level < XkbKeyGroupWidth(key, group); level++) { + if (key->groups[group].levels[level].num_syms != 1 || + key->groups[group].levels[level].u.sym != sym) continue; /* |