- ModMapEntry *mm;
- bool clobber;
-
- clobber = (new->merge != MERGE_AUGMENT);
- darray_foreach(mm, info->modMaps) {
- if (new->haveSymbol && mm->haveSymbol
- && (new->u.keySym == mm->u.keySym)) {
- xkb_mod_index_t use, ignore;
- if (mm->modifier != new->modifier) {
- if (clobber) {
- use = new->modifier;
- ignore = mm->modifier;
- }
- else {
- use = mm->modifier;
- ignore = new->modifier;
- }
- log_err(info->keymap->ctx,
- "%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));
- mm->modifier = use;
- }
- return true;
- }
- if ((!new->haveSymbol) && (!mm->haveSymbol) &&
- (new->u.keyName == mm->u.keyName)) {
- xkb_mod_index_t use, ignore;
- if (mm->modifier != new->modifier) {
- if (clobber) {
- use = new->modifier;
- ignore = mm->modifier;
- }
- else {
- use = mm->modifier;
- ignore = new->modifier;
- }
- log_err(info->keymap->ctx,
- "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));
- mm->modifier = use;
- }
+ ModMapEntry *old;
+ bool clobber = (new->merge != MERGE_AUGMENT);
+
+ darray_foreach(old, info->modmaps) {
+ xkb_mod_index_t use, ignore;
+
+ if ((new->haveSymbol != old->haveSymbol) ||
+ (new->haveSymbol && new->u.keySym != old->u.keySym) ||
+ (!new->haveSymbol && new->u.keyName != old->u.keyName))
+ continue;
+
+ if (new->modifier == old->modifier)