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, XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc,
uint32_t needed) uint32_t needed)
{ {
struct xkb_key *key;
size_t old_ndx, old_num_acts, new_ndx; size_t old_ndx, old_num_acts, new_ndx;
key = XkbKey(keymap, kc); key = XkbKey(keymap, kc);
@ -79,8 +80,9 @@ XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc,
return NULL; return NULL;
} }
if (XkbKeyHasActions(keymap, kc) && key = XkbKey(keymap, kc);
XkbKeyGroupsWidth(keymap, kc) >= needed)
if (XkbKeyHasActions(keymap, kc) && key->width >= needed)
return XkbKeyActionsPtr(keymap, kc); return XkbKeyActionsPtr(keymap, kc);
/* /*

View File

@ -913,7 +913,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
NULL, NULL); NULL, NULL);
} }
write_buf(keymap, buf, size, offset, " ]"); write_buf(keymap, buf, size, offset, " ]");
acts += XkbKeyGroupsWidth(keymap, kc); acts += key->width;
} }
} }
write_buf(keymap, buf, size, offset, "\n\t\t};\n"); 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; 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 static inline unsigned int
XkbKeyNumSyms(struct xkb_keymap *keymap, xkb_keycode_t kc, XkbKeyNumSyms(struct xkb_keymap *keymap, xkb_keycode_t kc,
unsigned int group, unsigned int level) unsigned int group, unsigned int level)
{ {
unsigned char width = XkbKeyGroupsWidth(keymap, kc); struct xkb_key *key = XkbKey(keymap, kc);
return XkbKey(keymap, kc)->num_syms[group * width + level]; return key->num_syms[group * key->width + level];
} }
static inline xkb_keysym_t * static inline xkb_keysym_t *
@ -416,8 +410,8 @@ static inline int
XkbKeySymOffset(struct xkb_keymap *keymap, xkb_keycode_t kc, XkbKeySymOffset(struct xkb_keymap *keymap, xkb_keycode_t kc,
unsigned group, unsigned int level) unsigned group, unsigned int level)
{ {
unsigned char width = XkbKeyGroupsWidth(keymap, kc); struct xkb_key *key = XkbKey(keymap, kc);
return XkbKey(keymap, kc)->sym_index[group * width + level]; return key->sym_index[group * key->width + level];
} }
static inline xkb_keysym_t * static inline xkb_keysym_t *
@ -453,9 +447,9 @@ static inline union xkb_action *
XkbKeyActionEntry(struct xkb_keymap *keymap, xkb_keycode_t kc, XkbKeyActionEntry(struct xkb_keymap *keymap, xkb_keycode_t kc,
unsigned int group, unsigned int level) unsigned int group, unsigned int level)
{ {
unsigned char width = XkbKeyGroupsWidth(keymap, kc); struct xkb_key *key = XkbKey(keymap, kc);
if (XkbKeyHasActions(keymap, kc)) if (XkbKeyHasActions(keymap, kc))
return &XkbKeyActionsPtr(keymap, kc)[width * group + level]; return &XkbKeyActionsPtr(keymap, kc)[key->width * group + level];
return NULL; return NULL;
} }

View File

@ -892,7 +892,6 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
uint32_t vmodmask = 0; uint32_t vmodmask = 0;
int num_acts = 0; int num_acts = 0;
int group, level; int group, level;
int width = XkbKeyGroupsWidth(keymap, kc);
struct xkb_key *key; struct xkb_key *key;
int i; int i;
@ -908,7 +907,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
for (group = 0; group < key->num_groups; group++) { for (group = 0; group < key->num_groups; group++) {
for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group); for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
level++) { level++) {
i = (group * width) + level; i = (group * key->width) + level;
if (i >= INTERP_SIZE) /* XXX FIXME */ if (i >= INTERP_SIZE) /* XXX FIXME */
return false; return false;
interps[i] = FindInterpForKey(keymap, kc, group, level); interps[i] = FindInterpForKey(keymap, kc, group, level);
@ -918,7 +917,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
} }
if (num_acts) if (num_acts)
num_acts = key->num_groups * width; num_acts = key->num_groups * key->width;
acts = XkbcResizeKeyActions(keymap, kc, num_acts); acts = XkbcResizeKeyActions(keymap, kc, num_acts);
if (num_acts && !acts) if (num_acts && !acts)
return false; return false;
@ -928,7 +927,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
level++) { level++) {
struct xkb_sym_interpret *interp; struct xkb_sym_interpret *interp;
i = (group * width) + level; i = (group * key->width) + level;
interp = interps[i]; interp = interps[i];
/* Infer default key behaviours from the base level. */ /* Infer default key behaviours from the base level. */