vmod: don't allow to add a vmod with the name of a real mod
Otherwise strange thing might ensue. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
b65980ccff
commit
9a2ce2a5ad
|
@ -43,6 +43,7 @@ bool
|
||||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, VModInfo *info)
|
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, VModInfo *info)
|
||||||
{
|
{
|
||||||
xkb_mod_index_t i;
|
xkb_mod_index_t i;
|
||||||
|
const char *name;
|
||||||
const struct xkb_vmod *vmod;
|
const struct xkb_vmod *vmod;
|
||||||
struct xkb_vmod new;
|
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; "
|
"Support for setting a value in a virtual_modifiers statement has been removed; "
|
||||||
"Value ignored\n");
|
"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) {
|
darray_enumerate(i, vmod, keymap->vmods) {
|
||||||
if (vmod->name == stmt->name) {
|
if (vmod->name == stmt->name) {
|
||||||
info->available |= 1 << i;
|
info->available |= 1 << i;
|
||||||
|
|
Loading…
Reference in New Issue