write_buf(buf, "\t\t\tvirtualModifier= %s;\n",
ModIndexText(keymap, interp->virtual_mod));
- if (interp->match & MATCH_LEVEL_ONE_ONLY)
+ if (interp->level_one_only)
write_buf(buf, "\t\t\tuseModMapMods=level1;\n");
if (interp->repeat)
write_buf(buf, "\t\t\trepeat= True;\n");
- write_action(keymap, buf, &interp->act, "\t\t\taction= ", ";\n");
+ write_action(keymap, buf, &interp->action, "\t\t\taction= ", ";\n");
write_buf(buf, "\t\t};\n");
}
}
if (UseNewInterpField(SI_FIELD_ACTION, old, new, report,
&collide)) {
- old->interp.act = new->interp.act;
+ old->interp.action = new->interp.action;
old->defined |= SI_FIELD_ACTION;
}
if (UseNewInterpField(SI_FIELD_AUTO_REPEAT, old, new, report,
}
if (UseNewInterpField(SI_FIELD_LEVEL_ONE_ONLY, old, new, report,
&collide)) {
- old->interp.match &= ~MATCH_LEVEL_ONE_ONLY;
- old->interp.match |= (new->interp.match & MATCH_LEVEL_ONE_ONLY);
+ old->interp.level_one_only = new->interp.level_one_only;
old->defined |= SI_FIELD_LEVEL_ONE_ONLY;
}
if (arrayNdx)
return ReportSINotArray(info, si, field);
- if (!HandleActionDef(value, keymap, &si->interp.act, info->actions))
+ if (!HandleActionDef(value, keymap, &si->interp.action, info->actions))
return false;
si->defined |= SI_FIELD_ACTION;
if (!ExprResolveEnum(keymap->ctx, value, &val, useModMapValueNames))
return ReportSIBadType(info, si, field, "level specification");
- if (val)
- si->interp.match |= MATCH_LEVEL_ONE_ONLY;
- else
- si->interp.match &= ~MATCH_LEVEL_ONE_ONLY;
-
+ si->interp.level_one_only = !!val;
si->defined |= SI_FIELD_LEVEL_ONE_ONLY;
}
else {
}
si = info->dflt;
-
si.merge = merge = (def->merge == MERGE_DEFAULT ? merge : def->merge);
if (!LookupKeysym(def->sym, &si.interp.sym)) {
return false;
}
- si.interp.match = pred & MATCH_OP_MASK;
-
+ si.interp.match = pred;
si.interp.mods = mods;
if (!HandleInterpBody(info, def->def, &si)) {
{
SymInterpInfo *si;
- darray_foreach(si, info->interps) {
- if (((si->interp.match & MATCH_OP_MASK) != pred) ||
- (needSymbol && si->interp.sym == XKB_KEY_NoSymbol) ||
- (!needSymbol && si->interp.sym != XKB_KEY_NoSymbol))
- continue;
-
- darray_append(info->keymap->sym_interprets, si->interp);
- }
+ darray_foreach(si, info->interps)
+ if (si->interp.match == pred &&
+ (si->interp.sym != XKB_KEY_NoSymbol) == needSymbol)
+ darray_append(info->keymap->sym_interprets, si->interp);
}
static void
if (!darray_empty(info->interps)) {
/* Most specific to least specific. */
CopyInterps(info, true, MATCH_EXACTLY);
- CopyInterps(info, true, MATCH_ALL | MATCH_NONE);
+ CopyInterps(info, true, MATCH_ALL);
+ CopyInterps(info, true, MATCH_NONE);
CopyInterps(info, true, MATCH_ANY);
CopyInterps(info, true, MATCH_ANY_OR_NONE);
CopyInterps(info, false, MATCH_EXACTLY);
- CopyInterps(info, false, MATCH_ALL | MATCH_NONE);
+ CopyInterps(info, false, MATCH_ALL);
+ CopyInterps(info, false, MATCH_NONE);
CopyInterps(info, false, MATCH_ANY);
CopyInterps(info, false, MATCH_ANY_OR_NONE);
}
.match = MATCH_ANY_OR_NONE,
.mods = 0,
.virtual_mod = XKB_MOD_INVALID,
- .act = { .type = ACTION_TYPE_NONE },
+ .action = { .type = ACTION_TYPE_NONE },
};
/**
interp->sym != XKB_KEY_NoSymbol)
continue;
- if (level == 0 || !(interp->match & MATCH_LEVEL_ONE_ONLY))
- mods = key->modmap;
- else
+ if (interp->level_one_only && level != 0)
mods = 0;
+ else
+ mods = key->modmap;
- switch (interp->match & MATCH_OP_MASK) {
+ switch (interp->match) {
case MATCH_NONE:
found = !(interp->mods & mods);
break;
case MATCH_EXACTLY:
found = (interp->mods == mods);
break;
- default:
- found = false;
- break;
}
if (found)
if (!(key->explicit & EXPLICIT_REPEAT) && interp->repeat)
key->repeats = true;
- if ((group == 0 && level == 0) ||
- !(interp->match & MATCH_LEVEL_ONE_ONLY)) {
+ if ((group == 0 && level == 0) || !interp->level_one_only)
if (interp->virtual_mod != XKB_MOD_INVALID)
vmodmap |= (1 << interp->virtual_mod);
- }
- if (interp->act.type != ACTION_TYPE_NONE)
- key->groups[group].levels[level].action = interp->act;
+ if (interp->action.type != ACTION_TYPE_NONE)
+ key->groups[group].levels[level].action = interp->action;
}
}