From de36ff043e5445357f62e9a2c14a71eed037785e Mon Sep 17 00:00:00 2001 From: Liu Liu Date: Wed, 5 Jan 2022 13:38:51 +0100 Subject: [PATCH] Platform IME: add ImGuiPlatformImeData::InputLineHeight (unused by win32). (#3113) --- docs/CHANGELOG.txt | 1 + imgui.h | 1 + imgui_widgets.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 9fb0e9cd..ebb169e8 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -62,6 +62,7 @@ Other Changes: 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: add ImGuiPlatformImeData::InputLineHeight. (#3113) [@liuliu] - 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. diff --git a/imgui.h b/imgui.h index 3279f5f0..16e000d9 100644 --- a/imgui.h +++ b/imgui.h @@ -2834,6 +2834,7 @@ struct ImGuiPlatformImeData { bool WantVisible; // A widget wants the IME to be visible ImVec2 InputPos; // Position of the input cursor + float InputLineHeight; // Line height ImGuiPlatformImeData() { memset(this, 0, sizeof(*this)); } }; diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index be7fe47a..e83305cb 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -4763,6 +4763,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ { g.PlatformImeData.WantVisible = true; g.PlatformImeData.InputPos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize); + g.PlatformImeData.InputLineHeight = g.FontSize; } } }