summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-08-10 22:06:12 +0300
committerRan Benita <ran234@gmail.com>2012-08-10 22:06:12 +0300
commit600caac33ade86607372e9cb326fe14c8c2b25d6 (patch)
tree4a758236ef3b98618d3e43055380f90cdecfbb23 /src
parent87dff888abd107541bf232258793d0bcb162b37d (diff)
Remove XkbKeyTypeIndex and widen index type
We don't need the macro, and using char for the kt_index is imaginably too small. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/keymap-dump.c14
-rw-r--r--src/xkb-priv.h10
2 files changed, 8 insertions, 16 deletions
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index 7593068..f04f6cc 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -677,12 +677,12 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
if (key->explicit & XkbExplicitKeyTypesMask) {
bool multi_type = false;
- int type = XkbKeyTypeIndex(key, 0);
+ struct xkb_key_type *type = XkbKeyType(keymap, key, 0);
simple = false;
- for (group = 0; group < key->num_groups; group++) {
- if (XkbKeyTypeIndex(key, group) != type) {
+ for (group = 1; group < key->num_groups; group++) {
+ if (XkbKeyType(keymap, key, group) != type) {
multi_type = true;
break;
}
@@ -692,17 +692,15 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
for (group = 0; group < key->num_groups; group++) {
if (!(key->explicit & (1 << group)))
continue;
- type = XkbKeyTypeIndex(key, group);
+ type = XkbKeyType(keymap, key, group);
write_buf(buf, "\n\t\t\ttype[group%u]= \"%s\",",
group + 1,
- xkb_atom_text(keymap->ctx,
- keymap->types[type].name));
+ xkb_atom_text(keymap->ctx, type->name));
}
}
else {
write_buf(buf, "\n\t\t\ttype= \"%s\",",
- xkb_atom_text(keymap->ctx,
- keymap->types[type].name));
+ xkb_atom_text(keymap->ctx, type->name));
}
}
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 630760a..f53805f 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -323,7 +323,7 @@ struct xkb_key {
union xkb_action *actions;
- unsigned char kt_index[XkbNumKbdGroups];
+ unsigned kt_index[XkbNumKbdGroups];
xkb_group_index_t num_groups;
/* How many levels the largest group has. */
@@ -396,17 +396,11 @@ XkbKeyGetKeycode(struct xkb_keymap *keymap, struct xkb_key *key)
#define xkb_foreach_key(iter, keymap) \
xkb_foreach_key_from(iter, keymap, keymap->min_key_code)
-static inline unsigned char
-XkbKeyTypeIndex(struct xkb_key *key, xkb_group_index_t group)
-{
- return key->kt_index[group & 0x3];
-}
-
static inline struct xkb_key_type *
XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key,
xkb_group_index_t group)
{
- return &keymap->types[XkbKeyTypeIndex(key, group)];
+ return &keymap->types[key->kt_index[group]];
}
static inline xkb_level_index_t