https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b24e73d41cf14e7bf25b…
commit 6b24e73d41cf14e7bf25b5209c304e15d40514f5
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Aug 10 08:03:32 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Aug 10 08:03:32 2021 +0900
[IMM32] Rewrite ImmGetVirtualKey (#3889)
Implementing Japanese input. CORE-11700
---
dll/win32/imm32/imm.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index 2e89bf4c011..7ae9094844c 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -3130,25 +3130,22 @@ BOOL WINAPI ImmGetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
*/
UINT WINAPI ImmGetVirtualKey(HWND hWnd)
{
- OSVERSIONINFOA version;
- InputContextData *data = ImmGetContext( hWnd );
- TRACE("%p\n", hWnd);
-
- if ( data )
- return data->lastVK;
-
- version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
- GetVersionExA( &version );
- switch(version.dwPlatformId)
- {
- case VER_PLATFORM_WIN32_WINDOWS:
- return VK_PROCESSKEY;
- case VER_PLATFORM_WIN32_NT:
- return 0;
- default:
- FIXME("%d not supported\n",version.dwPlatformId);
- return VK_PROCESSKEY;
- }
+ HIMC hIMC;
+ LPINPUTCONTEXTDX pIC;
+ UINT ret = VK_PROCESSKEY;
+
+ TRACE("(%p)\n", hWnd);
+
+ hIMC = ImmGetContext(hWnd);
+ pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
+ if (!pIC)
+ return ret;
+
+ if (pIC->bHasVKey)
+ ret = pIC->nVKey;
+
+ ImmUnlockIMC(hIMC);
+ return ret;
}
/***********************************************************************