From e2734d23ef9c02c0bdd7783955c00785e64344ad Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 13 Mar 2015 11:16:11 +0000 Subject: [PATCH] Child window don't take focus when they first appear (focus left to parent) --- imgui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 2b45781c4..53d2d9afd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2807,8 +2807,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg window->Visible = true; // New windows appears in front - if (window->LastFrameDrawn < current_frame - 1) - FocusWindow(window); + if (!(flags & ImGuiWindowFlags_ChildWindow)) + if (window->LastFrameDrawn < current_frame - 1) + FocusWindow(window); window->LastFrameDrawn = current_frame; window->ClipRectStack.resize(0); @@ -8583,7 +8584,7 @@ void ImGui::ShowTestWindow(bool* opened) ImGui::Text("ImGui says hello."); //ImGui::Text("MousePos (%g, %g)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y); //ImGui::Text("MouseWheel %d", ImGui::GetIO().MouseWheel); - ImGui::Text("KeyMods %s%s%s", ImGui::GetIO().KeyCtrl ? "CTRL" : "", ImGui::GetIO().KeyShift ? "SHIFT" : "", ImGui::GetIO().KeyAlt? "ALT" : ""); + //ImGui::Text("KeyMods %s%s%s", ImGui::GetIO().KeyCtrl ? "CTRL" : "", ImGui::GetIO().KeyShift ? "SHIFT" : "", ImGui::GetIO().KeyAlt? "ALT" : ""); //ImGui::Text("WantCaptureMouse: %d", ImGui::GetIO().WantCaptureMouse); //ImGui::Text("WantCaptureKeyboard: %d", ImGui::GetIO().WantCaptureKeyboard);