mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-17 20:05:40 +00:00
Backends: Win32: handle WM_IME_CHAR/WM_IME_COMPOSITION messages to support Unicode inputs on MBCS Windows. (#9099, #3653, #5961)
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2025-12-03: Inputs: handle WM_IME_CHAR/WM_IME_COMPOSITION messages to support Unicode inputs on MBCS (non-Unicode) Windows. (#9099, #3653, #5961)
|
||||
// 2025-10-19: Inputs: Revert previous change to allow for io.ClearInputKeys() on focus-out not losing gamepad state.
|
||||
// 2025-09-23: Inputs: Minor optimization not submitting gamepad input if packet number has not changed.
|
||||
// 2025-09-18: Call platform_io.ClearPlatformHandlers() on shutdown.
|
||||
@@ -788,6 +789,24 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandlerEx(HWND hwnd, UINT msg, WPA
|
||||
io.AddInputCharacter(wch);
|
||||
}
|
||||
return 0;
|
||||
case WM_IME_COMPOSITION:
|
||||
{
|
||||
// Handling WM_IME_COMPOSITION ensure that WM_IME_CHAR value is correct even for MBCS apps.
|
||||
// (see #9099, #3653 and https://stackoverflow.com/questions/77450354 topics)
|
||||
LRESULT result = ::DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||
return (lParam & GCS_RESULTSTR) ? 1 : result;
|
||||
}
|
||||
case WM_IME_CHAR:
|
||||
if (::IsWindowUnicode(hwnd) == FALSE)
|
||||
{
|
||||
if (::IsDBCSLeadByte(HIBYTE(wParam)))
|
||||
wParam = (WPARAM)MAKEWORD(HIBYTE(wParam), LOBYTE(wParam));
|
||||
wchar_t wch = 0;
|
||||
::MultiByteToWideChar(bd->KeyboardCodePage, MB_PRECOMPOSED, (char*)&wParam, 2, &wch, 1);
|
||||
io.AddInputCharacterUTF16(wch);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
case WM_SETCURSOR:
|
||||
// This is required to restore cursor when transitioning from e.g resize borders to client area.
|
||||
if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor(io, bd->LastMouseCursor))
|
||||
|
||||
@@ -77,6 +77,8 @@ Other Changes:
|
||||
selects `VkSwapchainCreateInfoKHR`'s `compositeAlpha` value based on
|
||||
`cap.supportedCompositeAlpha`, which seems to be required on some Android
|
||||
devices. (#8784) [@FelixStach]
|
||||
- Win32: handle WM_IME_CHAR/WM_IME_COMPOSITION to support Unicode inputs on
|
||||
MBCS (non-Unicode) Windows. (#9099, #3653, #5961) [@ulhc, @ocornut, @Othereum]
|
||||
- Examples:
|
||||
- Win32+DirectX12: ignore seemingly incorrect D3D12_MESSAGE_ID_FENCE_ZERO_WAIT
|
||||
warning on startups on some setups. (#9084, #9093) [@RT2Code, @LeoGautheron]
|
||||
|
||||
Reference in New Issue
Block a user