This allows to combine virtual modifiers safely using a bitwise or operation. Also, warn when too many virtual modifier are defined. --- parser.y | 5 ++++- xkbdata.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/parser.y b/parser.y index cf1ca33..2def00a 100644 --- a/parser.y +++ b/parser.y @@ -315,7 +315,10 @@ vmods_def: /* Return the number of the virtual modifier. */ vmod: - IDENTIFIER { $$ = vmod_find ($1); } + IDENTIFIER + { if (($$ = vmod_find ($1)) != 0) + $$ = 1 << ($$ - 1); + } ; /* A single realmodifier. */ diff --git a/xkbdata.c b/xkbdata.c index 1cba0d5..4f022dd 100644 --- a/xkbdata.c +++ b/xkbdata.c @@ -376,6 +376,8 @@ vmod_add (char *vmodname) vmodnamel = vmn; lastvmod++; + if (lastvmod > 16) + debug_printf("warning: only sixteen virtual modifiers are supported, %s will not be functional.\n", vmodname); return 0; } -- 1.7.2