libxkbcommon/test
Ran Benita 089c3a1811 state: fix unbound virtual modifier bug
Recent xkeyboard-config introduced the following line in symbols/level3:
    vmods = LevelThree,
However, the XKM format which xkbcomp produces for the X server can't
handle explicit virtual modifiers such as this:
https://bugs.freedesktop.org/show_bug.cgi?id=4927

So by doing the following, for example:

setxkbmap -layout de (or another 3-level layouts)
xkbcomp $DISPLAY out.xkb
xkbcomp out.xkb $DISPLAY

The modifier is lost and can't be used for switching to Level3 (see the
included test).

We, however, are affected worse by this bug when we load the out.xkb
keymap. First, the FOUR_LEVEL_ALPHABETIC key type has these entries:
    map[None] = Level1;
    map[Shift] = Level2;
    map[Lock]  = Level2;
    map[LevelThree] = Level3;
    [...]
Now, because the LevelThree virtual modifier is not bound to anything,
the effective mask of the "map[LevelThree]" entry is just 0. So when
the modifier state is empty (initial state), this entry is chosen, and
we get Level3, instead of failing to match any entry and getting the
default Level1.

The difference in behavior from the xserver stems from this commit:
acdad6058d
Which removed the entry->active field. Without bugs, this would be
correct; however, it seems in this case we should just follow the
server's behavior.

The server sets the entry->active field like so in XKBMisc.c:
    /* entry is active if vmods are bound */
    entry->active = (mask != 0);
The xkblib spec explains this field, but does not specify how to
initialize it. This commit does the same as above but more directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:01 +00:00
..
data state: fix unbound virtual modifier bug 2013-03-18 22:20:01 +00:00
.gitignore test: add key processing benchmark 2012-10-24 23:27:40 +02:00
bench-key-proc.c test: add key processing benchmark 2012-10-24 23:27:40 +02:00
common.c Don't use xkbcommon-compat names in internal code 2012-09-24 09:08:53 +10:00
context.c Organize src/ and test/ headers 2012-09-16 15:20:18 +03:00
filecomp.c parser: remove XkbCompMapList rule 2012-09-30 14:20:16 +02:00
interactive.c test/interactive: also print the level 2013-03-18 22:20:01 +00:00
keyseq.c state: fix unbound virtual modifier bug 2013-03-18 22:20:01 +00:00
keysym.c test/keysym: '\e' is non-standard 2012-11-07 18:59:41 +02:00
log.c Change log env vars to XKB_LOG_LEVEL/VERBOSITY 2012-10-12 10:17:57 +02:00
print-compiled-keymap.c Add format argument to xkb_keymap_get_as_string 2012-09-24 09:13:32 +10:00
rmlvo-to-kccgst.c Organize src/ and test/ headers 2012-09-16 15:20:18 +03:00
rules-file.c API: add _context prefix to log-related functions 2012-09-24 09:08:54 +10:00
rulescomp.c API: add _context prefix to log-related functions 2012-09-24 09:08:54 +10:00
state.c state, context: allow passing NULL to *_unref() 2012-10-29 01:20:04 +02:00
stringcomp.c stringcomp: test compilation of a dump of a keymap created from rules 2012-10-10 19:44:23 +02:00
test.h Don't use xkbcommon-compat names in internal code 2012-09-24 09:08:53 +10:00