return (xkb_keycode_t)(key - keymap->keys.item);
}
-#define xkb_foreach_key_from(iter, keymap, from) \
- darray_foreach_from(iter, keymap->keys, from)
-
#define xkb_foreach_key(iter, keymap) \
- xkb_foreach_key_from(iter, keymap, keymap->min_key_code)
+ darray_foreach(iter, keymap->keys)
static inline struct xkb_key_type *
XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key,
darray_foreach(alias, info->aliases) {
/* Check that ->real is a key. */
- key = FindNamedKey(keymap, alias->real, false, 0);
+ key = FindNamedKey(keymap, alias->real, false);
if (!key) {
log_vrb(info->ctx, 5,
"Attempt to alias %s to non-existent key %s; Ignored\n",
}
/* Check that ->alias is not a key. */
- key = FindNamedKey(keymap, alias->alias, false, 0);
+ key = FindNamedKey(keymap, alias->alias, false);
if (key) {
log_vrb(info->ctx, 5,
"Attempt to create alias with the name of a real key; "
}
struct xkb_key *
-FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
- bool use_aliases, xkb_keycode_t start_from)
+FindNamedKey(struct xkb_keymap *keymap, unsigned long name, bool use_aliases)
{
struct xkb_key *key;
- if (start_from < keymap->min_key_code)
- start_from = keymap->min_key_code;
- else if (start_from > keymap->max_key_code)
- return NULL;
-
- xkb_foreach_key_from(key, keymap, start_from)
+ xkb_foreach_key(key, keymap)
if (KeyNameToLong(key->name) == name)
return key;
if (use_aliases) {
unsigned long new_name;
if (FindKeyNameForAlias(keymap, name, &new_name))
- return FindNamedKey(keymap, new_name, false, 0);
+ return FindNamedKey(keymap, new_name, false);
}
return NULL;
ClearGroupInfo(&keyi->groups[i]);
}
-/**
- * Copy the KeyInfo into the keyboard description.
- *
- * This function recurses.
- */
static bool
-CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
- xkb_keycode_t start_from)
+CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
{
struct xkb_keymap *keymap = info->keymap;
xkb_keycode_t kc;
xkb_group_index_t i, nGroups;
xkb_level_index_t width, tmp;
struct xkb_key_type * type;
- bool haveActions, autoType, useAlias;
+ bool haveActions, autoType;
unsigned types[XKB_NUM_GROUPS];
unsigned int symIndex = 0;
- useAlias = (start_from == 0);
-
- key = FindNamedKey(keymap, keyi->name, useAlias, start_from);
+ key = FindNamedKey(keymap, keyi->name, true);
if (!key) {
- if (start_from == 0)
- log_vrb(info->keymap->ctx, 5,
- "Key %s not found in keycodes; Symbols ignored\n",
- LongKeyNameText(keyi->name));
+ log_vrb(info->keymap->ctx, 5,
+ "Key %s not found in keycodes; Symbols ignored\n",
+ LongKeyNameText(keyi->name));
return false;
}
kc = XkbKeyGetKeycode(keymap, key);
key->explicit |= EXPLICIT_REPEAT;
}
- /* do the same thing for the next key */
- CopySymbolsDef(info, keyi, kc + 1);
return true;
}
struct xkb_keymap *keymap = info->keymap;
if (!entry->haveSymbol) {
- key = FindNamedKey(keymap, entry->u.keyName, true, 0);
+ key = FindNamedKey(keymap, entry->u.keyName, true);
if (!key) {
log_vrb(info->keymap->ctx, 5,
"Key %s not found in keycodes; "
/* copy! */
darray_foreach(keyi, info.keys)
- if (!CopySymbolsDef(&info, keyi, 0))
+ if (!CopySymbolsDef(&info, keyi))
info.errorCount++;
if (xkb_get_log_verbosity(keymap->ctx) > 3) {