1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Add support for WM_IME_CHAR in Win32 backend

Handle WM_IME_CHAR message for input character processing.
This commit is contained in:
ulhc 2025-11-28 23:05:45 +08:00 committed by GitHub
parent 75b6b612ed
commit 48e655706d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -879,6 +879,21 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandlerEx(HWND hwnd, UINT msg, WPA
case WM_INPUTLANGCHANGE:
ImGui_ImplWin32_UpdateKeyboardCodePage(io);
return 0;
case WM_IME_CHAR :
if (::IsWindowUnicode(hwnd) == FALSE)
{
unsigned short ch = (unsigned short)wParam;
if (::IsDBCSLeadByte(HIBYTE(wParam)))
{
ch = MAKEWORD(HIBYTE(wParam), LOBYTE(wParam));
}
wchar_t wch = 0;
::MultiByteToWideChar(bd->KeyboardCodePage, MB_PRECOMPOSED, (char*)&ch, sizeof(ch), &wch, 1);
io.AddInputCharacterUTF16(wch);
return 1;
}
return 0;
case WM_CHAR:
if (::IsWindowUnicode(hwnd))
{