mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 00:39:02 +08:00
Platform IME: add ImGuiPlatformImeData::WantVisible, hide IME when not used. (#2589)
This commit is contained in:
parent
1cbfe93520
commit
29a8ee0826
@ -61,6 +61,7 @@ Other Changes:
|
||||
- Platform IME: changed io.ImeSetInputScreenPosFn() to io.SetPlatformImeDataFn() API,
|
||||
now taking a ImGuiPlatformImeData structure which we can more easily extend in the future.
|
||||
- Platform IME: moved io.ImeWindowHandle to GetMainViewport()->PlatformHandleRaw.
|
||||
- Platform IME: add ImGuiPlatformImeData::WantVisible, hide IME composition window when not used. (#2589) [@actboy168]
|
||||
- Platform IME: [windows] call ImmSetCandidateWindow() to position candidate window.
|
||||
- Backends: OpenGL3: Fixed a buffer overflow in imgui_impl_opengl3_loader.h init (added in 1.86). (#4468, #4830) [@dymk]
|
||||
It would generally not have noticeable side-effect at runtime but would be detected by runtime checkers.
|
||||
|
@ -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 = {};
|
||||
|
3
imgui.h
3
imgui.h
@ -2832,7 +2832,10 @@ struct ImGuiViewport
|
||||
// (Optional) Support for IME (Input Method Editor) via the io.SetPlatformImeDataFn() function.
|
||||
struct ImGuiPlatformImeData
|
||||
{
|
||||
bool WantVisible; // A widget wants the IME to be visible
|
||||
ImVec2 InputPos; // Position of the input cursor
|
||||
|
||||
ImGuiPlatformImeData() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -4760,7 +4760,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
|
||||
// Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)
|
||||
if (!is_readonly)
|
||||
{
|
||||
g.PlatformImeData.WantVisible = true;
|
||||
g.PlatformImeData.InputPos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user