diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-16 02:12:38 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-21 10:29:51 -0700 |
commit | 83fef4235db86343477b4ec9858c6ba35e1aa7d9 (patch) | |
tree | 2f13579992680ea9c1e71dea4909c84f20a1bd9c /hw/xnest | |
parent | 4597ac6fe0580323860080dae2576733acc49757 (diff) |
Xnest: Match the host's keymap
This was a regression.
Introduced by: 08363c5830bdea34012dcd954b45ccfdc79a3a7e and
32db27a7f867b503c2840ca7b815e96d10be9210
Masked by: 1e69fd4a60147287b31e53bfc61543fb17bb82c8
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'hw/xnest')
-rw-r--r-- | hw/xnest/Keyboard.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index ec629dcaf..5ef376b91 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -114,11 +114,13 @@ xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) int xnestKeyboardProc(DeviceIntPtr pDev, int onoff) { + XModifierKeymap *modifier_keymap; KeySym *keymap; int mapWidth; int min_keycode, max_keycode; KeySymsRec keySyms; - int i; + CARD8 modmap[MAP_LENGTH]; + int i, j; XKeyboardState values; XkbDescPtr xkb; int op, event, error, major, minor; @@ -130,7 +132,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff) #ifdef _XSERVER64 { KeySym64 *keymap64; - int i, len; + int len; keymap64 = XGetKeyboardMapping(xnestDisplay, min_keycode, max_keycode - min_keycode + 1, @@ -147,7 +149,17 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff) max_keycode - min_keycode + 1, &mapWidth); #endif - + + memset(modmap, 0, sizeof(modmap)); + modifier_keymap = XGetModifierMapping(xnestDisplay); + for (j = 0; j < 8; j++) + for(i = 0; i < modifier_keymap->max_keypermod; i++) { + CARD8 keycode; + if ((keycode = modifier_keymap->modifiermap[j * modifier_keymap->max_keypermod + i])) + modmap[keycode] |= 1<<j; + } + XFreeModifiermap(modifier_keymap); + keySyms.minKeyCode = min_keycode; keySyms.maxKeyCode = max_keycode; keySyms.mapWidth = mapWidth; @@ -165,7 +177,12 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff) XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb); InitKeyboardDeviceStruct(pDev, NULL, - xnestBell, xnestChangeKeyboardControl); + xnestBell, xnestChangeKeyboardControl); + + XkbApplyMappingChange(pDev, &keySyms, keySyms.minKeyCode, + keySyms.maxKeyCode - keySyms.minKeyCode + 1, + modmap, serverClient); + XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); XkbFreeKeyboard(xkb, 0, False); free(keymap); |