xkbcomp/keymap: correct ACTION_MODS_LOOKUP_MODS handling
authorRan Benita <ran234@gmail.com>
Wed, 19 Sep 2012 12:23:35 +0000 (15:23 +0300)
committerRan Benita <ran234@gmail.com>
Wed, 19 Sep 2012 12:23:35 +0000 (15:23 +0300)
The xkblib spec says:
    If XkbSA_UseModMapMods is not set in the flags field, the mask,
    real_mods, vmods1, and vmods2 fields are used to determine the
    action modifiers. Otherwise they are ignored and the modifiers
    bound to the key (client map->modmap[keycode]) are used instead.

So we should just assign the modmap without considering what's there.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/keymap.c

index 59fea7a..6e9c911 100644 (file)
@@ -47,29 +47,19 @@ ComputeEffectiveMask(struct xkb_keymap *keymap, struct xkb_mods *mods)
 
 static void
 UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
-                 xkb_mod_mask_t rmodmask)
+                 xkb_mod_mask_t modmap)
 {
-    unsigned int flags;
-    struct xkb_mods *mods;
-
     switch (act->type) {
     case ACTION_TYPE_MOD_SET:
     case ACTION_TYPE_MOD_LATCH:
     case ACTION_TYPE_MOD_LOCK:
-        flags = act->mods.flags;
-        mods = &act->mods.mods;
+        if (act->mods.flags & ACTION_MODS_LOOKUP_MODMAP)
+            act->mods.mods.mods = modmap;
+        ComputeEffectiveMask(keymap, &act->mods.mods);
         break;
-
     default:
-        return;
-    }
-
-    if (flags & ACTION_MODS_LOOKUP_MODMAP) {
-        /* XXX: what's that. */
-        mods->mods &= 0xff;
-        mods->mods |= rmodmask;
+        break;
     }
-    ComputeEffectiveMask(keymap, mods);
 }
 
 /**