From 5fe4ae62cb3de58e7c8cef245170cd4a8abbf167 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 26 Mar 2015 17:24:05 +0000 Subject: [PATCH] Popup: clicking on empty space also close popup #126 --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 44248384..8c56ede0 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3309,7 +3309,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ } if (window->Flags & ImGuiWindowFlags_Popup) { - if (g.FocusedWindow != window) + if ((g.IO.MouseClicked[0] && (!g.HoveredWindow || g.HoveredWindow->RootWindow != window)) || (!g.FocusedWindow || g.FocusedWindow->RootWindow != window)) if (p_opened) *p_opened = false; }