From 9bc5c089b6c351b821bbd672f3c002b9b53ead03 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 31 Jan 2018 22:14:33 +0100 Subject: [PATCH] Internal: Avoid needlessly bringing parent of front-most child back to front. This is mostly to reduce flicker/confusion in Metrics when traversing windows. We could aim at separating the child windows from non-child windows at some point. --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 102505455..f0414555c 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5161,7 +5161,8 @@ void ImGui::Scrollbar(ImGuiLayoutType direction) void ImGui::BringWindowToFront(ImGuiWindow* window) { ImGuiContext& g = *GImGui; - if (g.Windows.back() == window) + ImGuiWindow* current_front_window = g.Windows.back(); + if (current_front_window == window || current_front_window->RootWindow == window) return; for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window if (g.Windows[i] == window)