diff --git a/src/alloc.c b/src/alloc.c index 0c329e2..d2e5f5e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -70,6 +70,7 @@ union xkb_action * XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc, uint32_t needed) { + struct xkb_key *key; size_t old_ndx, old_num_acts, new_ndx; key = XkbKey(keymap, kc); @@ -79,8 +80,9 @@ XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc, return NULL; } - if (XkbKeyHasActions(keymap, kc) && - XkbKeyGroupsWidth(keymap, kc) >= needed) + key = XkbKey(keymap, kc); + + if (XkbKeyHasActions(keymap, kc) && key->width >= needed) return XkbKeyActionsPtr(keymap, kc); /* diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 893453d..27a0759 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -913,7 +913,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, NULL, NULL); } write_buf(keymap, buf, size, offset, " ]"); - acts += XkbKeyGroupsWidth(keymap, kc); + acts += key->width; } } write_buf(keymap, buf, size, offset, "\n\t\t};\n"); diff --git a/src/xkb-priv.h b/src/xkb-priv.h index bef38c3..822ee44 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -392,18 +392,12 @@ XkbKeyGroupWidth(struct xkb_keymap *keymap, xkb_keycode_t kc, return XkbKeyType(keymap, kc, group)->num_levels; } -static inline unsigned char -XkbKeyGroupsWidth(struct xkb_keymap *keymap, xkb_keycode_t kc) -{ - return XkbKey(keymap, kc)->width; -} - static inline unsigned int XkbKeyNumSyms(struct xkb_keymap *keymap, xkb_keycode_t kc, unsigned int group, unsigned int level) { - unsigned char width = XkbKeyGroupsWidth(keymap, kc); - return XkbKey(keymap, kc)->num_syms[group * width + level]; + struct xkb_key *key = XkbKey(keymap, kc); + return key->num_syms[group * key->width + level]; } static inline xkb_keysym_t * @@ -416,8 +410,8 @@ static inline int XkbKeySymOffset(struct xkb_keymap *keymap, xkb_keycode_t kc, unsigned group, unsigned int level) { - unsigned char width = XkbKeyGroupsWidth(keymap, kc); - return XkbKey(keymap, kc)->sym_index[group * width + level]; + struct xkb_key *key = XkbKey(keymap, kc); + return key->sym_index[group * key->width + level]; } static inline xkb_keysym_t * @@ -453,9 +447,9 @@ static inline union xkb_action * XkbKeyActionEntry(struct xkb_keymap *keymap, xkb_keycode_t kc, unsigned int group, unsigned int level) { - unsigned char width = XkbKeyGroupsWidth(keymap, kc); + struct xkb_key *key = XkbKey(keymap, kc); if (XkbKeyHasActions(keymap, kc)) - return &XkbKeyActionsPtr(keymap, kc)[width * group + level]; + return &XkbKeyActionsPtr(keymap, kc)[key->width * group + level]; return NULL; } diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 93b8480..d06dae6 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -892,7 +892,6 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc) uint32_t vmodmask = 0; int num_acts = 0; int group, level; - int width = XkbKeyGroupsWidth(keymap, kc); struct xkb_key *key; int i; @@ -908,7 +907,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc) for (group = 0; group < key->num_groups; group++) { for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group); level++) { - i = (group * width) + level; + i = (group * key->width) + level; if (i >= INTERP_SIZE) /* XXX FIXME */ return false; interps[i] = FindInterpForKey(keymap, kc, group, level); @@ -918,7 +917,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc) } if (num_acts) - num_acts = key->num_groups * width; + num_acts = key->num_groups * key->width; acts = XkbcResizeKeyActions(keymap, kc, num_acts); if (num_acts && !acts) return false; @@ -928,7 +927,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc) level++) { struct xkb_sym_interpret *interp; - i = (group * width) + level; + i = (group * key->width) + level; interp = interps[i]; /* Infer default key behaviours from the base level. */