summaryrefslogtreecommitdiff
path: root/src/xkbcomp
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-10-06 17:21:09 +0200
committerRan Benita <ran234@gmail.com>2012-10-06 21:42:00 +0200
commit39232e6dae3f7fcaae49ed05cb0e48117a46616e (patch)
tree89cb15d90d2b5099c03458ff0b33565ec8967942 /src/xkbcomp
parente6e3bda3934345bce203558df57ade467e62a337 (diff)
downloadxorg-lib-libxkbcommon-39232e6dae3f7fcaae49ed05cb0e48117a46616e.tar.gz
Remove now-unneeded mod type annotations
Most of the mod type annotations can now be changed to MOD_BOTH, because if you pass a mask which can only contain real mods in the first place to e.g. ModMaskText, then MOD_REAL and MOD_BOTH will give the same result. In the cases where MOD_BOTH is only ever the argument, we just remove it. What's left is where it really "matters". Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp')
-rw-r--r--src/xkbcomp/compat.c2
-rw-r--r--src/xkbcomp/keymap.c4
-rw-r--r--src/xkbcomp/symbols.c14
-rw-r--r--src/xkbcomp/types.c29
4 files changed, 24 insertions, 25 deletions
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 522389b..5678074 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -210,7 +210,7 @@ siText(SymInterpInfo *si, CompatInfo *info)
snprintf(buf, sizeof(buf), "%s+%s(%s)",
KeysymText(si->interp.sym),
SIMatchText(si->interp.match),
- ModMaskText(info->keymap, si->interp.mods, MOD_REAL));
+ ModMaskText(info->keymap, si->interp.mods));
return buf;
}
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index 81e584e..f670a08 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -39,7 +39,7 @@ ComputeEffectiveMask(struct xkb_keymap *keymap, struct xkb_mods *mods)
mods->mask = mods->mods & 0xff;
darray_enumerate(i, mod, keymap->mods)
- if (mod->type == MOD_VIRT && mods->mods & (1 << i))
+ if (mods->mods & (1 << i))
mods->mask |= mod->mapping;
}
@@ -198,7 +198,7 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap)
/* Update keymap->mods, the virtual -> real mod mapping. */
xkb_foreach_key(key, keymap)
darray_enumerate(i, mod, keymap->mods)
- if (mod->type == MOD_VIRT && key->vmodmap & (1 << i))
+ if (key->vmodmap & (1 << i))
mod->mapping |= key->modmap;
/* Now update the level masks for all the types to reflect the vmods. */
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 5c5e6c7..ee4c8c1 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -463,8 +463,8 @@ AddModMapEntry(SymbolsInfo *info, ModMapEntry *new)
"%s added to symbol map for multiple modifiers; "
"Using %s, ignoring %s.\n",
KeysymText(new->u.keySym),
- ModIndexText(info->keymap, use, MOD_REAL),
- ModIndexText(info->keymap, ignore, MOD_REAL));
+ ModIndexText(info->keymap, use),
+ ModIndexText(info->keymap, ignore));
mm->modifier = use;
}
return true;
@@ -485,8 +485,8 @@ AddModMapEntry(SymbolsInfo *info, ModMapEntry *new)
"Key %s added to map for multiple modifiers; "
"Using %s, ignoring %s.\n",
KeyNameText(info->keymap->ctx, new->u.keyName),
- ModIndexText(info->keymap, use, MOD_REAL),
- ModIndexText(info->keymap, ignore, MOD_REAL));
+ ModIndexText(info->keymap, use),
+ ModIndexText(info->keymap, ignore));
mm->modifier = use;
}
return true;
@@ -1238,7 +1238,7 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
log_err(info->keymap->ctx,
"Modmap entries may contain only key names or keysyms; "
"Illegal definition for %s modifier ignored\n",
- ModIndexText(info->keymap, tmp.modifier, MOD_REAL));
+ ModIndexText(info->keymap, tmp.modifier));
continue;
}
@@ -1573,7 +1573,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
"Key %s not found in keycodes; "
"Modifier map entry for %s not updated\n",
KeyNameText(keymap->ctx, entry->u.keyName),
- ModIndexText(info->keymap, entry->modifier, MOD_REAL));
+ ModIndexText(info->keymap, entry->modifier));
return false;
}
}
@@ -1584,7 +1584,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
"Key \"%s\" not found in symbol map; "
"Modifier map entry for %s not updated\n",
KeysymText(entry->u.keySym),
- ModIndexText(info->keymap, entry->modifier, MOD_REAL));
+ ModIndexText(info->keymap, entry->modifier));
return false;
}
}
diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c
index 39a730a..ebfc99d 100644
--- a/src/xkbcomp/types.c
+++ b/src/xkbcomp/types.c
@@ -168,7 +168,7 @@ typedef struct {
static inline const char *
MapEntryTxt(KeyTypesInfo *info, struct xkb_kt_map_entry *entry)
{
- return ModMaskText(info->keymap, entry->mods.mods, MOD_BOTH);
+ return ModMaskText(info->keymap, entry->mods.mods);
}
static inline const char *
@@ -180,7 +180,7 @@ TypeTxt(KeyTypesInfo *info, KeyTypeInfo *type)
static inline const char *
TypeMaskTxt(KeyTypesInfo *info, KeyTypeInfo *type)
{
- return ModMaskText(info->keymap, type->mods, MOD_BOTH);
+ return ModMaskText(info->keymap, type->mods);
}
static inline bool
@@ -377,7 +377,7 @@ SetModifiers(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
"Using %s, ignoring %s\n",
xkb_atom_text(info->keymap->ctx, type->name),
TypeMaskTxt(info, type),
- ModMaskText(info->keymap, mods, MOD_BOTH));
+ ModMaskText(info->keymap, mods));
return false;
}
@@ -456,8 +456,7 @@ SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
"Map entry for unused modifiers in %s; "
"Using %s instead of %s\n",
TypeTxt(info, type),
- ModMaskText(info->keymap, entry.mods.mods & type->mods,
- MOD_BOTH),
+ ModMaskText(info->keymap, entry.mods.mods & type->mods),
MapEntryTxt(info, &entry));
entry.mods.mods &= type->mods;
}
@@ -498,7 +497,7 @@ AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type,
log_vrb(info->keymap->ctx, 10,
"Identical definitions for preserve[%s] in %s; "
"Ignored\n",
- ModMaskText(info->keymap, mods, MOD_BOTH),
+ ModMaskText(info->keymap, mods),
TypeTxt(info, type));
return true;
}
@@ -507,10 +506,10 @@ AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type,
log_vrb(info->keymap->ctx, 1,
"Multiple definitions for preserve[%s] in %s; "
"Using %s, ignoring %s\n",
- ModMaskText(info->keymap, mods, MOD_BOTH),
+ ModMaskText(info->keymap, mods),
TypeTxt(info, type),
- ModMaskText(info->keymap, preserve_mods, MOD_BOTH),
- ModMaskText(info->keymap, entry->preserve.mods, MOD_BOTH));
+ ModMaskText(info->keymap, preserve_mods),
+ ModMaskText(info->keymap, entry->preserve.mods));
entry->preserve.mods = preserve_mods;
return true;
@@ -544,9 +543,9 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
if (mods & ~type->mods) {
const char *before, *after;
- before = ModMaskText(info->keymap, mods, MOD_BOTH);
+ before = ModMaskText(info->keymap, mods);
mods &= type->mods;
- after = ModMaskText(info->keymap, mods, MOD_BOTH);
+ after = ModMaskText(info->keymap, mods);
log_vrb(info->keymap->ctx, 1,
"Preserve for modifiers not used by the %s type; "
@@ -558,7 +557,7 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
log_err(info->keymap->ctx,
"Preserve value in a key type is not a modifier mask; "
"Ignoring preserve[%s] in type %s\n",
- ModMaskText(info->keymap, mods, MOD_BOTH),
+ ModMaskText(info->keymap, mods),
TypeTxt(info, type));
return false;
}
@@ -566,14 +565,14 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
if (preserve_mods & ~mods) {
const char *before, *after;
- before = ModMaskText(info->keymap, preserve_mods, MOD_BOTH);
+ before = ModMaskText(info->keymap, preserve_mods);
preserve_mods &= mods;
- after = ModMaskText(info->keymap, preserve_mods, MOD_BOTH);
+ after = ModMaskText(info->keymap, preserve_mods);
log_vrb(info->keymap->ctx, 1,
"Illegal value for preserve[%s] in type %s; "
"Converted %s to %s\n",
- ModMaskText(info->keymap, mods, MOD_BOTH),
+ ModMaskText(info->keymap, mods),
TypeTxt(info, type), before, after);
}