Allow ToAscii/ToUnicode to work with scanCode = 0.

This commit is contained in:
Dmitry Timoshkov 2002-02-12 18:42:50 +00:00 committed by Alexandre Julliard
parent 8961f1624e
commit f40fb64d6f
1 changed files with 14 additions and 12 deletions

View File

@ -997,12 +997,7 @@ void X11DRV_InitKeyboard( BYTE *key_state_table )
int k;
for (k = 0; k < keysyms_per_keycode; k += 1)
if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Mode_switch)
{
AltGrMask = 1 << i;
TRACE_(key)("AltGrMask is %x\n", AltGrMask);
}
else if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock)
if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock)
{
NumLockMask = 1 << i;
TRACE_(key)("NumLockMask is %x\n", NumLockMask);
@ -1506,12 +1501,6 @@ INT X11DRV_ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
int keyc;
BYTE lpChar[2];
if (scanCode==0) {
/* This happens when doing Alt+letter : a fake 'down arrow' key press
event is generated by windows. Just ignore it. */
TRACE("scanCode=0, doing nothing\n");
return 0;
}
if (scanCode & 0x8000)
{
TRACE("Key UP, doing nothing\n" );
@ -1521,15 +1510,28 @@ INT X11DRV_ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
e.keycode = 0;
e.state = 0;
if (lpKeyState[VK_SHIFT] & 0x80)
{
TRACE("ShiftMask = %04x\n", ShiftMask);
e.state |= ShiftMask;
}
if (lpKeyState[VK_CAPITAL] & 0x01)
{
TRACE("LockMask = %04x\n", LockMask);
e.state |= LockMask;
}
if (lpKeyState[VK_CONTROL] & 0x80)
{
TRACE("ControlMask = %04x\n", ControlMask);
e.state |= ControlMask;
}
if (lpKeyState[VK_NUMLOCK] & 0x01)
{
TRACE("NumLockMask = %04x\n", NumLockMask);
e.state |= NumLockMask;
}
/* Restore saved AltGr state */
TRACE("AltGrMask = %04x\n", AltGrMask);
e.state |= AltGrMask;
TRACE_(key)("(%04X, %04X) : faked state = %X\n",