Remove GroupsWidth macro

Use key->width directly instead.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-07-15 14:02:36 +03:00
parent c705a82d60
commit ad8875c526
4 changed files with 14 additions and 19 deletions

View File

@ -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);
/*

View File

@ -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");

View File

@ -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;
}

View File

@ -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. */