From 1722a31155ffddbfe254d3690c162a6675083f78 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 14 Aug 2018 11:32:24 -0700 Subject: [PATCH] Viewport: ImGuiWindowFlags_NoFocusOnAppearing affects viewport accordingly. (#1542) --- imgui.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 64b3540e..33cd67f3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5233,7 +5233,10 @@ ImGuiViewportP* ImGui::AddUpdateViewport(ImGuiWindow* window, ImGuiID id, const viewport->Size = size; viewport->PlatformMonitor = FindPlatformMonitorForRect(viewport->GetRect()); g.Viewports.push_back(viewport); - + + if (window && (window->Flags & ImGuiWindowFlags_NoFocusOnAppearing)) + flags |= ImGuiViewportFlags_NoFocusOnAppearing; + // We normally setup for all viewports in NewFrame() but here need to handle the mid-frame creation of a new viewport. // We need to extend the fullscreen clip rect so the OverlayDrawList clip is correct for that the first frame g.DrawListSharedData.ClipRectFullscreen.z = ImMax(g.DrawListSharedData.ClipRectFullscreen.z, viewport->Pos.x + viewport->Size.x);