Platform IME: Fixed multi-viewports IME support, affecting SDL backends. (#8648, #8584, #7492, #6341)
Regression from merging bf0f586b6
diff --git a/imgui.cpp b/imgui.cpp
index 9a4c016..4e914f0 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -4158,7 +4158,6 @@
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
- PlatformImeViewport = 0;
DockNodeWindowMenuHandler = NULL;
@@ -5898,7 +5897,7 @@
ImGuiPlatformImeData* ime_data = &g.PlatformImeData;
if (g.PlatformIO.Platform_SetImeDataFn != NULL && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0)
{
- ImGuiViewport* viewport = FindViewportByID(g.PlatformImeViewport);
+ ImGuiViewport* viewport = FindViewportByID(ime_data->ViewportId);
IMGUI_DEBUG_LOG_IO("[io] Calling Platform_SetImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f)\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y);
if (viewport == NULL)
viewport = GetMainViewport();
diff --git a/imgui_internal.h b/imgui_internal.h
index 4d28f0e..7d67f54 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -2568,7 +2568,6 @@
// Platform support
ImGuiPlatformImeData PlatformImeData; // Data updated by current frame. Will be applied at end of the frame. For some backends, this is required to have WantVisible=true in order to receive text message.
ImGuiPlatformImeData PlatformImeDataPrev; // Previous frame data. When changed we call the platform_io.Platform_SetImeDataFn() handler.
- ImGuiID PlatformImeViewport;
// Extensions
// FIXME: We could provide an API to register one slot in an array held in ImGuiContext?