keymap: rename XkbKeyGroupWidth to XkbKeyNumLevels

The "width" terminology comes from the group*width+level layout of the
keysyms in a key, as used in the old implementations. We don't keep all
the keysyms of a key in one array so change it to a more accurate name.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2014-09-25 22:01:17 +03:00
parent 2c259f1782
commit 725ae134d4
5 changed files with 9 additions and 10 deletions

View File

@ -72,7 +72,7 @@ xkb_keymap_unref(struct xkb_keymap *keymap)
if (key->groups) {
for (unsigned i = 0; i < key->num_groups; i++) {
if (key->groups[i].levels) {
for (unsigned j = 0; j < XkbKeyGroupWidth(key, i); j++)
for (unsigned j = 0; j < XkbKeyNumLevels(key, i); j++)
if (key->groups[i].levels[j].num_syms > 1)
free(key->groups[i].levels[j].u.syms);
free(key->groups[i].levels);
@ -363,7 +363,7 @@ xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc,
if (layout == XKB_LAYOUT_INVALID)
return 0;
return XkbKeyGroupWidth(key, layout);
return XkbKeyNumLevels(key, layout);
}
/**
@ -429,7 +429,7 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap,
if (layout == XKB_LAYOUT_INVALID)
goto err;
if (level >= XkbKeyGroupWidth(key, layout))
if (level >= XkbKeyNumLevels(key, layout))
goto err;
num_syms = key->groups[layout].levels[level].num_syms;

View File

@ -432,7 +432,7 @@ XkbKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
}
static inline xkb_level_index_t
XkbKeyGroupWidth(const struct xkb_key *key, xkb_layout_index_t layout)
XkbKeyNumLevels(const struct xkb_key *key, xkb_layout_index_t layout)
{
return key->groups[layout].type->num_levels;
}

View File

@ -455,7 +455,7 @@ static bool
write_keysyms(struct xkb_keymap *keymap, struct buf *buf,
const struct xkb_key *key, xkb_layout_index_t group)
{
for (xkb_level_index_t level = 0; level < XkbKeyGroupWidth(key, group);
for (xkb_level_index_t level = 0; level < XkbKeyNumLevels(key, group);
level++) {
const xkb_keysym_t *syms;
int num_syms;
@ -576,8 +576,7 @@ write_key(struct xkb_keymap *keymap, struct buf *buf,
write_buf(buf, " ]");
if (show_actions) {
write_buf(buf, ",\n\t\tactions[Group%u]= [ ", group + 1);
for (level = 0;
level < XkbKeyGroupWidth(key, group); level++) {
for (level = 0; level < XkbKeyNumLevels(key, group); level++) {
if (level != 0)
write_buf(buf, ", ");
write_action(keymap, buf,

View File

@ -136,7 +136,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key)
return true;
for (group = 0; group < key->num_groups; group++) {
for (level = 0; level < XkbKeyGroupWidth(key, group); level++) {
for (level = 0; level < XkbKeyNumLevels(key, group); level++) {
const struct xkb_sym_interpret *interp;
interp = FindInterpForKey(keymap, key, group, level);
@ -202,7 +202,7 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap)
/* Update action modifiers. */
xkb_keys_foreach(key, keymap)
for (i = 0; i < key->num_groups; i++)
for (j = 0; j < XkbKeyGroupWidth(key, i); j++)
for (j = 0; j < XkbKeyNumLevels(key, i); j++)
UpdateActionMods(keymap, &key->groups[i].levels[j].action,
key->modmap);

View File

@ -1256,7 +1256,7 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym)
got_one_level = false;
xkb_keys_foreach(key, keymap) {
if (group < key->num_groups &&
level < XkbKeyGroupWidth(key, group)) {
level < XkbKeyNumLevels(key, group)) {
got_one_group = got_one_level = true;
if (key->groups[group].levels[level].num_syms == 1 &&
key->groups[group].levels[level].u.sym == sym)