From 79c075ca09c94f863dc324d9d784ba8853dc86db Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 21 Sep 2018 18:50:45 +0200 Subject: [PATCH] Docking+Viewport: Fixed PlatformRequestClose (e.g. ALT-F4) being redrected to the first window of the docking node instead of the selected one. --- imgui.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 140f75f3..d4929341 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5422,9 +5422,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Close from platform window if (p_open != NULL && window->Viewport->PlatformRequestClose && window->Viewport != GetMainViewport()) { - window->Viewport->PlatformRequestClose = false; - g.NavWindowingToggleLayer = false; // Assume user mapped PlatformRequestClose on ALT-F4 so we disable ALT for menu toggle. False positive not an issue. - *p_open = false; + if (!window->DockIsActive || window->DockTabIsVisible) + { + window->Viewport->PlatformRequestClose = false; + g.NavWindowingToggleLayer = false; // Assume user mapped PlatformRequestClose on ALT-F4 so we disable ALT for menu toggle. False positive not an issue. + *p_open = false; + } } // Title bar