diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c index ebd5371..51269be 100644 --- a/src/xkbcomp/vmod.c +++ b/src/xkbcomp/vmod.c @@ -43,6 +43,7 @@ bool HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, VModInfo *info) { xkb_mod_index_t i; + const char *name; const struct xkb_vmod *vmod; struct xkb_vmod new; @@ -51,6 +52,15 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, VModInfo *info) "Support for setting a value in a virtual_modifiers statement has been removed; " "Value ignored\n"); + name = xkb_atom_text(keymap->ctx, stmt->name); + if (ModNameToIndex(name) != XKB_MOD_INVALID) { + log_err(keymap->ctx, + "Can't add a virtual modifier named \"%s\"; " + "there is already a non-virtual modifier with this name! Ignored\n", + name); + return false; + } + darray_enumerate(i, vmod, keymap->vmods) { if (vmod->name == stmt->name) { info->available |= 1 << i;