Platform IME: add ImGuiPlatformImeData::WantVisible, hide IME when not used. (#2589)

This commit is contained in:
actboy168
2022-01-05 13:20:54 +01:00
committed by ocornut
parent 1cbfe93520
commit 29a8ee0826
4 changed files with 10 additions and 0 deletions

View File

@ -4149,6 +4149,7 @@ void ImGui::NewFrame()
// Platform IME data: reset for the frame
g.PlatformImeDataPrev = g.PlatformImeData;
g.PlatformImeData.WantVisible = false;
// Mouse wheel scrolling, scale
UpdateMouseWheel();
@ -11510,6 +11511,8 @@ static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatf
if (hwnd == 0)
return;
::ImmAssociateContextEx(hwnd, NULL, data->WantVisible ? IACE_DEFAULT : 0);
if (HIMC himc = ::ImmGetContext(hwnd))
{
COMPOSITIONFORM composition_form = {};