* Ran Benita <ran234@gmail.com>
*/
+#include "config.h"
+
#include "xkbcomp-priv.h"
#include "text.h"
#include "expr.h"
typedef struct {
enum merge_mode merge;
bool haveSymbol;
+ // NOTE: Can also be XKB_MOD_NONE, meaning
+ // “don’t add a modifier to the modmap”.
xkb_mod_index_t modifier;
union {
xkb_atom_t keyName;
/* First find the type of the merged group. */
if (into->type != from->type) {
if (from->type == XKB_ATOM_NONE) {
+ /* it's empty for consistency with other comparisons */
}
else if (into->type == XKB_ATOM_NONE) {
into->type = from->type;
struct xkb_level *fromLevel = &darray_item(from->levels, i);
if (fromLevel->action.type == ACTION_TYPE_NONE) {
+ /* it's empty for consistency with other comparisons */
}
else if (intoLevel->action.type == ACTION_TYPE_NONE) {
intoLevel->action = fromLevel->action;
}
if (fromLevel->num_syms == 0) {
+ /* it's empty for consistency with other comparisons */
}
else if (intoLevel->num_syms == 0) {
intoLevel->num_syms = fromLevel->num_syms;
ignore = (clobber ? old->modifier : new->modifier);
if (new->haveSymbol)
- log_err(info->ctx,
- "Symbol \"%s\" added to modifier map for multiple modifiers; "
- "Using %s, ignoring %s\n",
- KeysymText(info->ctx, new->u.keySym),
- ModIndexText(info->ctx, &info->mods, use),
- ModIndexText(info->ctx, &info->mods, ignore));
+ log_warn(info->ctx,
+ "Symbol \"%s\" added to modifier map for multiple modifiers; "
+ "Using %s, ignoring %s\n",
+ KeysymText(info->ctx, new->u.keySym),
+ ModIndexText(info->ctx, &info->mods, use),
+ ModIndexText(info->ctx, &info->mods, ignore));
else
- log_err(info->ctx,
- "Key \"%s\" added to modifier map for multiple modifiers; "
- "Using %s, ignoring %s\n",
- KeyNameText(info->ctx, new->u.keyName),
- ModIndexText(info->ctx, &info->mods, use),
- ModIndexText(info->ctx, &info->mods, ignore));
+ log_warn(info->ctx,
+ "Key \"%s\" added to modifier map for multiple modifiers; "
+ "Using %s, ignoring %s\n",
+ KeyNameText(info->ctx, new->u.keyName),
+ ModIndexText(info->ctx, &info->mods, use),
+ ModIndexText(info->ctx, &info->mods, ignore));
old->modifier = use;
return true;
}
nActs = 0;
- for (act = value->unary.child; act; act = (ExprDef *) act->common.next)
+ for (act = value->actions.actions; act; act = (ExprDef *) act->common.next)
nActs++;
if (darray_size(groupi->levels) < nActs)
groupi->defined |= GROUP_FIELD_ACTS;
- act = value->unary.child;
+ act = value->actions.actions;
for (unsigned i = 0; i < nActs; i++) {
union xkb_action *toAct = &darray_item(groupi->levels, i).action;
xkb_mod_index_t ndx;
bool ok;
struct xkb_context *ctx = info->ctx;
-
- ndx = XkbModNameToIndex(&info->mods, def->modifier, MOD_REAL);
- if (ndx == XKB_MOD_INVALID) {
- log_err(info->ctx,
- "Illegal modifier map definition; "
- "Ignoring map for non-modifier \"%s\"\n",
- xkb_atom_text(ctx, def->modifier));
- return false;
+ const char *modifier_name = xkb_atom_text(ctx, def->modifier);
+
+ if (istreq(modifier_name, "none")) {
+ // Handle special "None" entry
+ ndx = XKB_MOD_NONE;
+ } else {
+ // Handle normal entry
+ ndx = XkbModNameToIndex(&info->mods, def->modifier, MOD_REAL);
+ if (ndx == XKB_MOD_INVALID) {
+ log_err(info->ctx,
+ "Illegal modifier map definition; "
+ "Ignoring map for non-modifier \"%s\"\n",
+ xkb_atom_text(ctx, def->modifier));
+ return false;
+ }
}
ok = true;
}
}
- key->modmap |= (1u << entry->modifier);
+ // Handle modMap None
+ if (entry->modifier != XKB_MOD_NONE) {
+ // Convert modifier index to modifier mask
+ key->modmap |= (1u << entry->modifier);
+ }
+
return true;
}