diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c index 5c21f2f9da9..f4648d7b6e9 100644 --- a/win32ss/user/ntuser/ime.c +++ b/win32ss/user/ntuser/ime.c @@ -565,15 +565,14 @@ DWORD FASTCALL UserBuildHimcList(PTHREADINFO pti, DWORD dwCount, HIMC *phList) return dwRealCount; } -// Win: xxxImmProcessKey UINT FASTCALL IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - UINT uVirtualKey, ret = 0; + UINT uVirtualKey, ret; DWORD dwHotKeyId; PKL pKL; - PIMC pIMC = NULL; + PIMC pIMC; PIMEHOTKEY pImeHotKey; HKL hKL; HWND hWnd; @@ -592,6 +591,7 @@ IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT uMsg, return 0; } + pIMC = NULL; hWnd = UserHMGetHandle(pWnd); pKL = pWnd->head.pti->KeyboardLayout; if (!pKL) @@ -638,7 +638,7 @@ IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT uMsg, if (!pIMC) return 0; - if ((lParam & 0x80000000) && + if ((lParam & (KF_UP << 16)) && (pKL->piiex->ImeInfo.fdwProperty & IME_PROP_IGNORE_UPKEYS)) { return 0; diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index bcec00196bc..c8ae61ad4eb 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -1769,17 +1769,16 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) USER_REFERENCE_ENTRY Ref; PWND pWnd; UINT ImmRet; - BOOL Ret = TRUE; + BOOL Ret = TRUE, bKeyUpDown = FALSE; PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); + const UINT uMsg = Msg->message; - if (Msg->message == VK_PACKET) - { - pti->wchInjected = HIWORD(Msg->wParam); - } + if (uMsg == VK_PACKET) + pti->wchInjected = HIWORD(Msg->wParam); - if (Msg->message == WM_KEYDOWN || Msg->message == WM_SYSKEYDOWN || - Msg->message == WM_KEYUP || Msg->message == WM_SYSKEYUP) + if (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN || uMsg == WM_KEYUP || uMsg == WM_SYSKEYUP) { + bKeyUpDown = TRUE; switch (Msg->wParam) { case VK_LSHIFT: case VK_RSHIFT: @@ -1797,7 +1796,7 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) pWnd = ValidateHwndNoErr(Msg->hwnd); if (pWnd) UserRefObjectCo(pWnd, &Ref); - Event.message = Msg->message; + Event.message = uMsg; Event.hwnd = Msg->hwnd; Event.time = Msg->time; Event.paramL = (Msg->wParam & 0xFF) | (HIWORD(Msg->lParam) << 8); @@ -1807,7 +1806,7 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) if (*RemoveMessages) { - if ((Msg->message == WM_KEYDOWN) && + if ((uMsg == WM_KEYDOWN) && (Msg->hwnd != IntGetDesktopWindow())) { /* Handle F1 key by sending out WM_HELP message */ @@ -1822,7 +1821,7 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) co_IntSendMessage(Msg->hwnd, WM_APPCOMMAND, (WPARAM)Msg->hwnd, MAKELPARAM(0, (FAPPCOMMAND_KEY | (Msg->wParam - VK_BROWSER_BACK + 1)))); } } - else if (Msg->message == WM_KEYUP) + else if (uMsg == WM_KEYUP) { /* Handle VK_APPS key by posting a WM_CONTEXTMENU message */ if (Msg->wParam == VK_APPS && pti->MessageQueue->MenuOwner == NULL) @@ -1831,7 +1830,7 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) } //// Key Down! - if ( *RemoveMessages && Msg->message == WM_SYSKEYDOWN ) + if (*RemoveMessages && uMsg == WM_SYSKEYDOWN) { if ( HIWORD(Msg->lParam) & KF_ALTDOWN ) { @@ -1869,9 +1868,10 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages) Ret = FALSE; } - if ( pWnd && Ret && *RemoveMessages && Msg->message == WM_KEYDOWN && !(pti->TIF_flags & TIF_DISABLEIME)) + if (pWnd && Ret && *RemoveMessages && bKeyUpDown && !(pti->TIF_flags & TIF_DISABLEIME)) { - if ( (ImmRet = IntImmProcessKey(pti->MessageQueue, pWnd, Msg->message, Msg->wParam, Msg->lParam)) ) + ImmRet = IntImmProcessKey(pti->MessageQueue, pWnd, uMsg, Msg->wParam, Msg->lParam); + if (ImmRet) { if ( ImmRet & (IPHK_HOTKEY|IPHK_SKIPTHISKEY) ) {