dix: add XI event support to FixKeyState.

FixKeyState needs to be able to handle XI events, otherwise we get "impossible
keyboard events" on server zaps and other special key combos.
This commit is contained in:
Peter Hutterer 2007-09-06 18:52:02 +09:30
parent 6334d4e7be
commit 5ee409794e

View File

@ -3584,7 +3584,7 @@ drawable.id:0;
#ifdef XKB #ifdef XKB
/* This function is used to set the key pressed or key released state - /* This function is used to set the key pressed or key released state -
this is only used when the pressing of keys does not cause this is only used when the pressing of keys does not cause
CoreProcessKeyEvent to be called, as in for example Mouse Keys. the device's processInputProc to be called, as in for example Mouse Keys.
*/ */
void void
FixKeyState (xEvent *xE, DeviceIntPtr keybd) FixKeyState (xEvent *xE, DeviceIntPtr keybd)
@ -3597,23 +3597,20 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd)
kptr = &keyc->down[key >> 3]; kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7); bit = 1 << (key & 7);
if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease)||
(xE->u.u.type==DeviceKeyPress)||(xE->u.u.type==DeviceKeyRelease))
) {
DebugF("FixKeyState: Key %d %s\n",key, DebugF("FixKeyState: Key %d %s\n",key,
(xE->u.u.type==KeyPress?"down":"up")); (((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress))?"down":"up"));
} }
switch (xE->u.u.type) if (xE->u.u.type == KeyPress || xE->u.u.type == DeviceKeyPress)
{
case KeyPress:
*kptr |= bit; *kptr |= bit;
break; else if (xE->u.u.type == KeyRelease || xE->u.u.type == DeviceKeyRelease)
case KeyRelease:
*kptr &= ~bit; *kptr &= ~bit;
break; else
default:
FatalError("Impossible keyboard event"); FatalError("Impossible keyboard event");
} }
}
#endif #endif
/** /**