Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-unicode IME support #3653

Open
wants to merge 6 commits into
base: docking
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions backends/imgui_impl_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,22 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
case WM_KILLFOCUS:
io.AddFocusEvent(msg == WM_SETFOCUS);
return 0;
#if HAS_WIN32_IME
case WM_IME_COMPOSITION:
if (lParam & GCS_RESULTSTR)
{
if (HIMC himc = ::ImmGetContext(hwnd))
{
wchar_t buffer;
::ImmGetCompositionStringW(himc, GCS_RESULTSTR, &buffer, sizeof(buffer));
::ImmReleaseContext(hwnd, himc);
io.AddInputCharacterUTF16(buffer);
}
}
return 0;
case WM_IME_CHAR:
return 1; // IME is processed above, so return 1 so that the WM_CHAR message is not generated.
#endif
case WM_CHAR:
// You can also use ToAscii()+GetKeyboardState() to retrieve characters.
if (wParam > 0 && wParam < 0x10000)
Expand Down