diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-05 10:40:20 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-05 10:45:20 +1000 |
commit | 5904ef2ccd6056b187ca76f104c21e2d686bfc1d (patch) | |
tree | ff3685791ea5b563901f3bd01c16b9838f37ab75 /hw | |
parent | 44afc7577ad3339f4555438388f6a4d8e220c991 (diff) |
xnest: restore xnestUpdateModifierState
The meat of xnestUpdateModifierState was ifdef'd out in
6ef46c40e62def4841a4cff4e0b443516a2ed782. This resulted in stuck modifiers
when a modifier key release event wasn't sent to Xnest (e.g. Alt-Tab away).
See X.Org Bug 3664 <https://bugs.freedesktop.org/show_bug.cgi?id=3664> for
the original bug report.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xnest/Keyboard.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index 191bec780..1835c7071 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -206,29 +206,19 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev) void xnestUpdateModifierState(unsigned int state) { -#if 0 DeviceIntPtr pDev = xnestKeyboardDevice; KeyClassPtr keyc = pDev->key; int i; CARD8 mask; + int xkb_state; if (!pDev) return; -/* This is pretty broken. - * - * What should happen is that focus out should do as a VT switch does in - * traditional servers: fake releases for all keys (and buttons too, come - * to think of it) currently down. Then, on focus in, get the state from - * the host, and fake keypresses for everything currently down. - * - * So I'm leaving this broken for a little while. Sorry, folks. - * - * -daniels - */ + xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state); state = state & 0xff; - if (keyc->state == state) + if (xkb_state == state) return; for (i = 0, mask = 1; i < 8; i++, mask <<= 1) { @@ -236,7 +226,7 @@ xnestUpdateModifierState(unsigned int state) /* Modifier is down, but shouldn't be */ - if ((keyc->state & mask) && !(state & mask)) { + if ((xkb_state & mask) && !(state & mask)) { int count = keyc->modifierKeyCount[i]; for (key = 0; key < MAP_LENGTH; key++) @@ -257,12 +247,11 @@ xnestUpdateModifierState(unsigned int state) /* Modifier shoud be down, but isn't */ - if (!(keyc->state & mask) && (state & mask)) + if (!(xkb_state & mask) && (state & mask)) for (key = 0; key < MAP_LENGTH; key++) if (keyc->xkbInfo->desc->map->modmap[key] & mask) { xnestQueueKeyEvent(KeyPress, key); break; } } -#endif } |