mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Fixed main viewport not being marked as created, which broke updating the IME input position for the main viewport.
This change also removes the logic scattered about that compensated for PlatformWindowCreated being wrong for the main viewport.
This commit is contained in:
parent
9afb849e16
commit
e7dca4fec2
@ -3790,6 +3790,7 @@ void ImGui::Initialize(ImGuiContext* context)
|
|||||||
ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
|
ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
|
||||||
viewport->ID = IMGUI_VIEWPORT_DEFAULT_ID;
|
viewport->ID = IMGUI_VIEWPORT_DEFAULT_ID;
|
||||||
viewport->Idx = 0;
|
viewport->Idx = 0;
|
||||||
|
viewport->PlatformWindowCreated = true;
|
||||||
g.Viewports.push_back(viewport);
|
g.Viewports.push_back(viewport);
|
||||||
g.PlatformIO.MainViewport = g.Viewports[0]; // Make it accessible in public-facing GetPlatformIO() immediately (before the first call to EndFrame)
|
g.PlatformIO.MainViewport = g.Viewports[0]; // Make it accessible in public-facing GetPlatformIO() immediately (before the first call to EndFrame)
|
||||||
g.PlatformIO.Viewports.push_back(g.Viewports[0]);
|
g.PlatformIO.Viewports.push_back(g.Viewports[0]);
|
||||||
@ -10078,7 +10079,7 @@ static void ImGui::UpdateViewportsNewFrame()
|
|||||||
for (int n = 0; n < g.Viewports.Size; n++)
|
for (int n = 0; n < g.Viewports.Size; n++)
|
||||||
{
|
{
|
||||||
ImGuiViewportP* viewport = g.Viewports[n];
|
ImGuiViewportP* viewport = g.Viewports[n];
|
||||||
const bool platform_funcs_available = (n == 0 || viewport->PlatformWindowCreated);
|
const bool platform_funcs_available = viewport->PlatformWindowCreated;
|
||||||
if ((g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable))
|
if ((g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable))
|
||||||
if (g.PlatformIO.Platform_GetWindowMinimized && platform_funcs_available)
|
if (g.PlatformIO.Platform_GetWindowMinimized && platform_funcs_available)
|
||||||
viewport->PlatformWindowMinimized = g.PlatformIO.Platform_GetWindowMinimized(viewport);
|
viewport->PlatformWindowMinimized = g.PlatformIO.Platform_GetWindowMinimized(viewport);
|
||||||
@ -10124,7 +10125,7 @@ static void ImGui::UpdateViewportsNewFrame()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool platform_funcs_available = (n == 0 || viewport->PlatformWindowCreated);
|
const bool platform_funcs_available = viewport->PlatformWindowCreated;
|
||||||
if ((g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable))
|
if ((g.ConfigFlagsForFrame & ImGuiConfigFlags_ViewportsEnable))
|
||||||
{
|
{
|
||||||
// Update Position and Size (from Platform Window to ImGui) if requested.
|
// Update Position and Size (from Platform Window to ImGui) if requested.
|
||||||
@ -10535,7 +10536,7 @@ void ImGui::UpdatePlatformWindows()
|
|||||||
for (int n = 0; n < g.Viewports.Size && focused_viewport == NULL; n++)
|
for (int n = 0; n < g.Viewports.Size && focused_viewport == NULL; n++)
|
||||||
{
|
{
|
||||||
ImGuiViewportP* viewport = g.Viewports[n];
|
ImGuiViewportP* viewport = g.Viewports[n];
|
||||||
if (n == 0 || viewport->PlatformWindowCreated)
|
if (viewport->PlatformWindowCreated)
|
||||||
if (g.PlatformIO.Platform_GetWindowFocus(viewport))
|
if (g.PlatformIO.Platform_GetWindowFocus(viewport))
|
||||||
focused_viewport = viewport;
|
focused_viewport = viewport;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user