symbols: remove unneeded recursion form CopySymbolsDef
This function does some funky stuff, which, as far as I can tell, was
needed to support the functionality of giving different keycodes the
same name and thus make them duplicates (MERGE_ALT_FORM). This stuff was
removed as useless in 0765064b3
, but this leftover wasn't noticed.
Signed-off-by: Ran Benita <ran234@gmail.com>
master
parent
ce5dbeff60
commit
77ab928e92
|
@ -422,11 +422,8 @@ XkbKeyGetKeycode(struct xkb_keymap *keymap, struct xkb_key *key)
|
||||||
return (xkb_keycode_t)(key - keymap->keys.item);
|
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) \
|
#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 *
|
static inline struct xkb_key_type *
|
||||||
XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key,
|
XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key,
|
||||||
|
|
|
@ -754,7 +754,7 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
|
||||||
|
|
||||||
darray_foreach(alias, info->aliases) {
|
darray_foreach(alias, info->aliases) {
|
||||||
/* Check that ->real is a key. */
|
/* Check that ->real is a key. */
|
||||||
key = FindNamedKey(keymap, alias->real, false, 0);
|
key = FindNamedKey(keymap, alias->real, false);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
log_vrb(info->ctx, 5,
|
log_vrb(info->ctx, 5,
|
||||||
"Attempt to alias %s to non-existent key %s; Ignored\n",
|
"Attempt to alias %s to non-existent key %s; Ignored\n",
|
||||||
|
@ -764,7 +764,7 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that ->alias is not a key. */
|
/* Check that ->alias is not a key. */
|
||||||
key = FindNamedKey(keymap, alias->alias, false, 0);
|
key = FindNamedKey(keymap, alias->alias, false);
|
||||||
if (key) {
|
if (key) {
|
||||||
log_vrb(info->ctx, 5,
|
log_vrb(info->ctx, 5,
|
||||||
"Attempt to create alias with the name of a real key; "
|
"Attempt to create alias with the name of a real key; "
|
||||||
|
@ -859,24 +859,18 @@ err_info:
|
||||||
}
|
}
|
||||||
|
|
||||||
struct xkb_key *
|
struct xkb_key *
|
||||||
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
FindNamedKey(struct xkb_keymap *keymap, unsigned long name, bool use_aliases)
|
||||||
bool use_aliases, xkb_keycode_t start_from)
|
|
||||||
{
|
{
|
||||||
struct xkb_key *key;
|
struct xkb_key *key;
|
||||||
|
|
||||||
if (start_from < keymap->min_key_code)
|
xkb_foreach_key(key, keymap)
|
||||||
start_from = keymap->min_key_code;
|
|
||||||
else if (start_from > keymap->max_key_code)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
xkb_foreach_key_from(key, keymap, start_from)
|
|
||||||
if (KeyNameToLong(key->name) == name)
|
if (KeyNameToLong(key->name) == name)
|
||||||
return key;
|
return key;
|
||||||
|
|
||||||
if (use_aliases) {
|
if (use_aliases) {
|
||||||
unsigned long new_name;
|
unsigned long new_name;
|
||||||
if (FindKeyNameForAlias(keymap, name, &new_name))
|
if (FindKeyNameForAlias(keymap, name, &new_name))
|
||||||
return FindNamedKey(keymap, new_name, false, 0);
|
return FindNamedKey(keymap, new_name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -56,7 +56,7 @@ LongKeyNameText(unsigned long val)
|
||||||
|
|
||||||
struct xkb_key *
|
struct xkb_key *
|
||||||
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
||||||
bool use_aliases, xkb_keycode_t start_from);
|
bool use_aliases);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FindKeyNameForAlias(struct xkb_keymap *keymap, unsigned long lname,
|
FindKeyNameForAlias(struct xkb_keymap *keymap, unsigned long lname,
|
||||||
|
|
|
@ -1490,14 +1490,8 @@ PrepareKeyDef(KeyInfo *keyi)
|
||||||
ClearGroupInfo(&keyi->groups[i]);
|
ClearGroupInfo(&keyi->groups[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy the KeyInfo into the keyboard description.
|
|
||||||
*
|
|
||||||
* This function recurses.
|
|
||||||
*/
|
|
||||||
static bool
|
static bool
|
||||||
CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
|
CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
|
||||||
xkb_keycode_t start_from)
|
|
||||||
{
|
{
|
||||||
struct xkb_keymap *keymap = info->keymap;
|
struct xkb_keymap *keymap = info->keymap;
|
||||||
xkb_keycode_t kc;
|
xkb_keycode_t kc;
|
||||||
|
@ -1506,18 +1500,15 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
|
||||||
xkb_group_index_t i, nGroups;
|
xkb_group_index_t i, nGroups;
|
||||||
xkb_level_index_t width, tmp;
|
xkb_level_index_t width, tmp;
|
||||||
struct xkb_key_type * type;
|
struct xkb_key_type * type;
|
||||||
bool haveActions, autoType, useAlias;
|
bool haveActions, autoType;
|
||||||
unsigned types[XKB_NUM_GROUPS];
|
unsigned types[XKB_NUM_GROUPS];
|
||||||
unsigned int symIndex = 0;
|
unsigned int symIndex = 0;
|
||||||
|
|
||||||
useAlias = (start_from == 0);
|
key = FindNamedKey(keymap, keyi->name, true);
|
||||||
|
|
||||||
key = FindNamedKey(keymap, keyi->name, useAlias, start_from);
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
if (start_from == 0)
|
log_vrb(info->keymap->ctx, 5,
|
||||||
log_vrb(info->keymap->ctx, 5,
|
"Key %s not found in keycodes; Symbols ignored\n",
|
||||||
"Key %s not found in keycodes; Symbols ignored\n",
|
LongKeyNameText(keyi->name));
|
||||||
LongKeyNameText(keyi->name));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
kc = XkbKeyGetKeycode(keymap, key);
|
kc = XkbKeyGetKeycode(keymap, key);
|
||||||
|
@ -1657,8 +1648,6 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
|
||||||
key->explicit |= EXPLICIT_REPEAT;
|
key->explicit |= EXPLICIT_REPEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do the same thing for the next key */
|
|
||||||
CopySymbolsDef(info, keyi, kc + 1);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1669,7 +1658,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
|
||||||
struct xkb_keymap *keymap = info->keymap;
|
struct xkb_keymap *keymap = info->keymap;
|
||||||
|
|
||||||
if (!entry->haveSymbol) {
|
if (!entry->haveSymbol) {
|
||||||
key = FindNamedKey(keymap, entry->u.keyName, true, 0);
|
key = FindNamedKey(keymap, entry->u.keyName, true);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
log_vrb(info->keymap->ctx, 5,
|
log_vrb(info->keymap->ctx, 5,
|
||||||
"Key %s not found in keycodes; "
|
"Key %s not found in keycodes; "
|
||||||
|
@ -1741,7 +1730,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
|
||||||
/* copy! */
|
/* copy! */
|
||||||
darray_foreach(keyi, info.keys)
|
darray_foreach(keyi, info.keys)
|
||||||
if (!CopySymbolsDef(&info, keyi, 0))
|
if (!CopySymbolsDef(&info, keyi))
|
||||||
info.errorCount++;
|
info.errorCount++;
|
||||||
|
|
||||||
if (xkb_get_log_verbosity(keymap->ctx) > 3) {
|
if (xkb_get_log_verbosity(keymap->ctx) > 3) {
|
||||||
|
|
Loading…
Reference in New Issue