x11/keymap: don't forget to add the vmod offset in get_vmods

The first 8 modifiers in keymap->mods are the real modifiers; the virtual
 modifiers are then at slots 8-24. But XkbGetMap's virtualMods mask
starts the virtual modifiers at zero, so we need to add an offset (like
we do correctly in get_vmod_names()).

https://github.com/xkbcommon/libxkbcommon/issues/9

Reported-by: @rtcm
Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2014-08-08 16:36:42 +03:00
parent 9db1432326
commit 01753c0475
1 changed files with 3 additions and 2 deletions

View File

@ -513,9 +513,10 @@ get_vmods(struct xkb_keymap *keymap, xcb_connection_t *conn,
for (unsigned i = 0; i < NUM_VMODS; i++) {
if (reply->virtualMods & (1u << i)) {
uint8_t wire = *iter;
struct xkb_mod *mod = &keymap->mods.mods[NUM_REAL_MODS + i];
keymap->mods.mods[i].type = MOD_VIRT;
keymap->mods.mods[i].mapping = translate_mods(wire, 0, 0);
mod->type = MOD_VIRT;
mod->mapping = translate_mods(wire, 0, 0);
iter++;
}