From 3e4c89051d81514f6eedeba59fc147c69d71c17f Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Thu, 15 Jul 2021 17:23:44 +0300 Subject: [PATCH] Popups: Fix OpenPopup() being called after BeginPopup() resulting in a failure to open a popup when focus is NULL. (#4308) Story of removed line begins in commit b80cf0a. It's purpose was to close popups when they lost focus. Later on few other changes were introduced: * bcc49ff - closing popups with RMB without changing window focus * af679a1 - closing popups in FocusWindow() These two changes covered all the cases of popup closing which made deleted line obsolete. Conveniently, now all popup closing is handled from within UpdateMouseMovingWindowEndFrame() either by calling FocusWindow() or ClosePopupsOverWindow(). --- docs/CHANGELOG.txt | 1 + imgui.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 698634b1..fbea1dbb 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -59,6 +59,7 @@ Other Changes: - Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272) - Menus: MenuItem() and BeginMenu() are not affected/overlapping when style.SelectableTextAlign is altered. - Menus: fix hovering a disabled menu or menu item not closing other menus. (#211) +- Popups: fix BeginPopup/OpenPopup sequence failing when there are no focused windows. (#4308) [@rokups] - Nav: Disabled items are not candidate for default focus. (#211, #787) - Disabled: disabled items set HoveredId, allowing e.g. HoveredIdTimer to function. (#211, #3419) [@rokups] - Disabled: disabled mode more consistently release active id if the active item got disabled. (#211) diff --git a/imgui.cpp b/imgui.cpp index 6c22c0c3..406d619b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4102,7 +4102,6 @@ void ImGui::NewFrame() g.ItemFlagsStack.resize(0); g.ItemFlagsStack.push_back(ImGuiItemFlags_None); g.GroupStack.resize(0); - ClosePopupsOverWindow(g.NavWindow, false); // [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack. UpdateDebugToolItemPicker();