[IMM32][NTUSER][SDK] Add ImmCallImeConsoleIME (#5271)

- Add <jpnvkeys.h>.
- Add imm32!ImmCallImeConsoleIME.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2023-05-10 14:04:01 +09:00 committed by GitHub
parent 6e3ad0411a
commit 4aff629302
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 17 deletions

View file

@ -9,6 +9,7 @@
@ stdcall ImmActivateLayout(ptr)
@ stdcall ImmAssociateContext(ptr ptr)
@ stdcall ImmAssociateContextEx(ptr ptr long)
@ stdcall ImmCallImeConsoleIME(ptr long ptr ptr ptr)
@ stdcall ImmConfigureIMEA(ptr ptr long ptr)
@ stdcall ImmConfigureIMEW(ptr ptr long ptr)
@ stdcall ImmCreateContext()

View file

@ -10,6 +10,7 @@
*/
#include "precomp.h"
#include <jpnvkeys.h>
WINE_DEFAULT_DEBUG_CHANNEL(imm);
@ -1195,3 +1196,94 @@ ImmSendMessageToActiveDefImeWndW(UINT uMsg, WPARAM wParam, LPARAM lParam)
return SendMessageW(hwndIME, uMsg, wParam, lParam);
}
/***********************************************************************
* ImmCallImeConsoleIME (IMM32.@)
*/
DWORD WINAPI
ImmCallImeConsoleIME(
_In_ HWND hWnd,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam,
_Out_ LPUINT puVK)
{
DWORD dwThreadId, ret = 0;
HKL hKL;
PWND pWnd = NULL;
HIMC hIMC;
PIMEDPI pImeDpi;
UINT uVK;
PIMC pIMC;
switch (uMsg)
{
case WM_KEYDOWN:
case WM_KEYUP:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
break;
default:
return 0;
}
dwThreadId = GetWindowThreadProcessId(hWnd, NULL);
hKL = GetKeyboardLayout(dwThreadId);
if (hWnd && gpsi)
pWnd = ValidateHwndNoErr(hWnd);
if (IS_NULL_UNEXPECTEDLY(pWnd))
return 0;
hIMC = ImmGetContext(hWnd);
if (IS_NULL_UNEXPECTEDLY(hIMC))
return 0;
uVK = *puVK = (wParam & 0xFF);
pIMC = ValidateHandleNoErr(hIMC, TYPE_INPUTCONTEXT);
if (IS_NULL_UNEXPECTEDLY(pIMC))
return 0;
pImeDpi = ImmLockImeDpi(hKL);
if (IS_NULL_UNEXPECTEDLY(pImeDpi))
return 0;
if ((lParam & MAKELPARAM(0, KF_UP)) && (pImeDpi->ImeInfo.fdwProperty & IME_PROP_IGNORE_UPKEYS))
goto Quit;
switch (uVK)
{
case VK_DBE_ROMAN:
case VK_DBE_NOROMAN:
case VK_DBE_HIRAGANA:
case VK_DBE_KATAKANA:
case VK_DBE_CODEINPUT:
case VK_DBE_NOCODEINPUT:
case VK_DBE_ENTERWORDREGISTERMODE:
case VK_DBE_ENTERCONFIGMODE:
break;
default:
{
if (uMsg == WM_SYSKEYDOWN || uMsg == WM_SYSKEYUP)
{
if (uVK != VK_MENU && uVK != VK_F10)
goto Quit;
}
if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_NEED_ALTKEY))
{
if (uVK == VK_MENU || (lParam & MAKELPARAM(0, KF_ALTDOWN)))
goto Quit;
}
}
}
ret = ImmProcessKey(hWnd, hKL, uVK, lParam, INVALID_HOTKEY_ID);
Quit:
ImmUnlockImeDpi(pImeDpi);
return ret;
}

View file

@ -0,0 +1,27 @@
/*
* PROJECT: ReactOS header
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
* PURPOSE: The special virtual keys for Japanese
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
/*
* The special virtual keys for Japanese: Used for key states.
* https://www.kthree.co.jp/kihelp/index.html?page=app/vkey&type=html
*/
#define VK_DBE_ALPHANUMERIC 0xF0
#define VK_DBE_KATAKANA 0xF1
#define VK_DBE_HIRAGANA 0xF2
#define VK_DBE_SBCSCHAR 0xF3
#define VK_DBE_DBCSCHAR 0xF4
#define VK_DBE_ROMAN 0xF5
#define VK_DBE_NOROMAN 0xF6
#define VK_DBE_ENTERWORDREGISTERMODE 0xF7
#define VK_DBE_ENTERCONFIGMODE 0xF8
#define VK_DBE_FLUSHSTRING 0xF9
#define VK_DBE_CODEINPUT 0xFA
#define VK_DBE_NOCODEINPUT 0xFB
#define VK_DBE_DETERINESTRING 0xFC
#define VK_DBE_ENTERDLGCONVERSIONMODE 0xFD

View file

@ -8,6 +8,8 @@
*/
#include <win32k.h>
#include <jpnvkeys.h>
DBG_DEFAULT_CHANNEL(UserMisc);
#define INVALID_THREAD_ID ((ULONG)-1)
@ -21,23 +23,6 @@ DBG_DEFAULT_CHANNEL(UserMisc);
#define LANGID_CHINESE_TRADITIONAL MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL)
#define LANGID_NEUTRAL MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
// The special virtual keys for Japanese: Used for key states.
// https://www.kthree.co.jp/kihelp/index.html?page=app/vkey&type=html
#define VK_DBE_ALPHANUMERIC 0xF0
#define VK_DBE_KATAKANA 0xF1
#define VK_DBE_HIRAGANA 0xF2
#define VK_DBE_SBCSCHAR 0xF3
#define VK_DBE_DBCSCHAR 0xF4
#define VK_DBE_ROMAN 0xF5
#define VK_DBE_NOROMAN 0xF6
#define VK_DBE_ENTERWORDREGISTERMODE 0xF7
#define VK_DBE_ENTERCONFIGMODE 0xF8
#define VK_DBE_FLUSHSTRING 0xF9
#define VK_DBE_CODEINPUT 0xFA
#define VK_DBE_NOCODEINPUT 0xFB
#define VK_DBE_DETERINESTRING 0xFC
#define VK_DBE_ENTERDLGCONVERSIONMODE 0xFD
HIMC ghIMC = NULL;
BOOL gfImeOpen = (BOOL)-1;
DWORD gdwImeConversion = (DWORD)-1;