[MSCTFIME] Implement CtfImeDispatchDefImeMessage (#6193)

and add IsMsImeMessage helper funciton.
CORE-19360
This commit is contained in:
Katayama Hirofumi MZ 2023-12-19 14:24:48 +09:00 committed by GitHub
parent 084fae1eb4
commit 64378a88ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 2 deletions

View file

@ -26,6 +26,20 @@ UINT WM_MSIME_SHOWIMEPAD = 0;
UINT WM_MSIME_MOUSE = 0;
UINT WM_MSIME_KEYMAP = 0;
BOOL IsMsImeMessage(UINT uMsg)
{
return (uMsg == WM_MSIME_SERVICE ||
uMsg == WM_MSIME_UIREADY ||
uMsg == WM_MSIME_RECONVERTREQUEST ||
uMsg == WM_MSIME_RECONVERT ||
uMsg == WM_MSIME_DOCUMENTFEED ||
uMsg == WM_MSIME_QUERYPOSITION ||
uMsg == WM_MSIME_MODEBIAS ||
uMsg == WM_MSIME_SHOWIMEPAD ||
uMsg == WM_MSIME_MOUSE ||
uMsg == WM_MSIME_KEYMAP);
}
typedef BOOLEAN (WINAPI *FN_DllShutDownInProgress)(VOID);
EXTERN_C BOOLEAN WINAPI
@ -871,6 +885,11 @@ CtfImeProcessCicHotkey(
return E_NOTIMPL;
}
/***********************************************************************
* CtfImeDispatchDefImeMessage (MSCTFIME.@)
*
* @implemented
*/
EXTERN_C LRESULT WINAPI
CtfImeDispatchDefImeMessage(
_In_ HWND hWnd,
@ -878,8 +897,29 @@ CtfImeDispatchDefImeMessage(
_In_ WPARAM wParam,
_In_ LPARAM lParam)
{
FIXME("stub:(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam);
return 0;
TRACE("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam);
TLS *pTLS = TLS::GetTLS();
if (pTLS)
{
if (uMsg == WM_CREATE)
++pTLS->m_cWnds;
else if (uMsg == WM_DESTROY)
--pTLS->m_cWnds;
}
if (!IsMsImeMessage(uMsg))
return 0;
HKL hKL = GetKeyboardLayout(0);
if (IS_IME_HKL(hKL))
return 0;
HWND hImeWnd = (HWND)SendMessageW(hWnd, WM_IME_NOTIFY, 0x17, 0);
if (!IsWindow(hImeWnd))
return 0;
return SendMessageW(hImeWnd, uMsg, wParam, lParam);
}
EXTERN_C BOOL WINAPI

View file

@ -28,4 +28,6 @@
#include "resource.h"
#define IS_IME_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == 0xE0000000)
extern HINSTANCE g_hInst;