xnest: restore xnestUpdateModifierState
The meat of xnestUpdateModifierState was ifdef'd out in
6ef46c40e6
. 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>
This commit is contained in:
parent
44afc7577a
commit
5904ef2ccd
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user