Fix translation of extended keys.

svn path=/trunk/; revision=17111
This commit is contained in:
Filip Navara 2005-08-06 18:56:20 +00:00
parent f3594ebab5
commit 4123ecfc6a
3 changed files with 44 additions and 7 deletions

View file

@ -10,7 +10,7 @@ InitKeyboardImpl(VOID);
PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID); PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID);
VOID W32kUnregisterPrimitiveMessageQueue(VOID); VOID W32kUnregisterPrimitiveMessageQueue(VOID);
PKBDTABLES W32kGetDefaultKeyLayout(VOID); PKBDTABLES W32kGetDefaultKeyLayout(VOID);
VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyLayout); VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyLayout, BYTE Prefix);
BOOL FASTCALL IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt); BOOL FASTCALL IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt);
BOOL FASTCALL IntMouseInput(MOUSEINPUT *mi); BOOL FASTCALL IntMouseInput(MOUSEINPUT *mi);
BOOL FASTCALL IntKeyboardInput(KEYBDINPUT *ki); BOOL FASTCALL IntKeyboardInput(KEYBDINPUT *ki);

View file

@ -628,7 +628,7 @@ KeyboardThreadMain(PVOID StartContext)
lParam |= (KeyInput.MakeCode & 0xff) << 16; lParam |= (KeyInput.MakeCode & 0xff) << 16;
if (KeyInput.Flags & (KEY_E0 | KEY_E1)) if (KeyInput.Flags & KEY_E0)
lParam |= (1 << 24); lParam |= (1 << 24);
if (ModifierState & MOD_ALT) if (ModifierState & MOD_ALT)
@ -673,7 +673,9 @@ KeyboardThreadMain(PVOID StartContext)
* keyboard layout in use. * keyboard layout in use.
*/ */
W32kKeyProcessMessage(&msg, W32kKeyProcessMessage(&msg,
FocusThread->Tcb.Win32Thread->KeyboardLayout); FocusThread->Tcb.Win32Thread->KeyboardLayout,
KeyInput.Flags & KEY_E0 ? 0xE0 :
(KeyInput.Flags & KEY_E1 ? 0xE1 : 0));
if (GetHotKey(InputWindowStation, if (GetHotKey(InputWindowStation,
ModifierState, ModifierState,

View file

@ -966,7 +966,11 @@ NtUserGetKeyNameText( LONG lParam, LPWSTR lpString, int nSize ) {
* appropriately. * appropriately.
*/ */
VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) { VOID FASTCALL
W32kKeyProcessMessage(LPMSG Msg,
PKBDTABLES KeyboardLayout,
BYTE Prefix)
{
DWORD ScanCode = 0, ModifierBits = 0; DWORD ScanCode = 0, ModifierBits = 0;
DWORD i = 0; DWORD i = 0;
DWORD BaseMapping = 0; DWORD BaseMapping = 0;
@ -984,6 +988,7 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
{ VK_UP, VK_NUMPAD8 }, { VK_UP, VK_NUMPAD8 },
{ VK_PRIOR, VK_NUMPAD9 }, { VK_PRIOR, VK_NUMPAD9 },
{ 0,0 } }; { 0,0 } };
PVSC_VK VscVkTable;
if( !KeyboardLayout || !Msg || if( !KeyboardLayout || !Msg ||
(Msg->message != WM_KEYDOWN && Msg->message != WM_SYSKEYDOWN && (Msg->message != WM_KEYDOWN && Msg->message != WM_SYSKEYDOWN &&
@ -1005,10 +1010,40 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
ScanCode = (Msg->lParam >> 16) & 0xff; ScanCode = (Msg->lParam >> 16) & 0xff;
BaseMapping = Msg->wParam = BaseMapping = Msg->wParam =
IntMapVirtualKeyEx( ScanCode, 1, KeyboardLayout ); IntMapVirtualKeyEx( ScanCode, 1, KeyboardLayout );
if( ScanCode >= KeyboardLayout->bMaxVSCtoVK ) if( Prefix == 0 )
RawVk = 0; {
if( ScanCode >= KeyboardLayout->bMaxVSCtoVK )
RawVk = 0xff;
else
RawVk = KeyboardLayout->pusVSCtoVK[ScanCode];
}
else else
RawVk = KeyboardLayout->pusVSCtoVK[ScanCode]; {
if( Prefix == 0xE0 )
{
/* ignore shift codes */
if( ScanCode == 0x2A || ScanCode == 0x36 )
{
IntUnLockQueueState;
return;
}
VscVkTable = KeyboardLayout->pVSCtoVK_E0;
}
else if( Prefix == 0xE1 )
{
VscVkTable = KeyboardLayout->pVSCtoVK_E1;
}
RawVk = 0xff;
while (VscVkTable->Vsc)
{
if( VscVkTable->Vsc == ScanCode )
{
RawVk = VscVkTable->Vk;
}
VscVkTable++;
}
}
if ((ModifierBits & NUMLOCK_BIT) && if ((ModifierBits & NUMLOCK_BIT) &&
!(ModifierBits & GetShiftBit(KeyboardLayout, VK_SHIFT)) && !(ModifierBits & GetShiftBit(KeyboardLayout, VK_SHIFT)) &&