From 07163804df6312590900bc2d3d6edd412fc0dee6 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 1 Feb 2018 18:31:41 +0100 Subject: [PATCH] Internals: Renamed CloseInactivePopups() to a better ClosePopupsOverWindow(). Exposed in imgui_internal.h --- imgui.cpp | 11 +++++------ imgui_internal.h | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index f0414555c..9d8755771 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -669,7 +669,6 @@ static void MarkIniSettingsDirty(ImGuiWindow* window); static ImRect GetViewportRect(); -static void CloseInactivePopups(ImGuiWindow* ref_window); static void ClosePopupToLevel(int remaining); static ImGuiWindow* GetFrontMostModalRootWindow(); @@ -2549,7 +2548,7 @@ void ImGui::NewFrame() // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear. g.CurrentWindowStack.resize(0); g.CurrentPopupStack.resize(0); - CloseInactivePopups(g.NavWindow); + ClosePopupsOverWindow(g.NavWindow); // Create implicit window - we will only render it if the user has added something to it. // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. @@ -3000,7 +2999,7 @@ void ImGui::EndFrame() } // With right mouse button we close popups without changing focus - // (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger) + // (The left mouse button path calls FocusWindow which will lead NewFrame->ClosePopupsOverWindow to trigger) if (g.IO.MouseClicked[1]) { // Find the top-most window between HoveredWindow and the front most Modal Window. @@ -3017,7 +3016,7 @@ void ImGui::EndFrame() if (window == g.HoveredWindow) hovered_window_above_modal = true; } - CloseInactivePopups(hovered_window_above_modal ? g.HoveredWindow : modal); + ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal); } } } @@ -3772,7 +3771,7 @@ void ImGui::OpenPopupEx(ImGuiID id) else g.OpenPopupStack[current_stack_size] = popup_ref; - // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by CloseInactivePopups(). + // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow(). // This is equivalent to what ClosePopupToLevel() does. //if (g.OpenPopupStack[current_stack_size].PopupId == id) // FocusWindow(parent_window); @@ -3785,7 +3784,7 @@ void ImGui::OpenPopup(const char* str_id) OpenPopupEx(g.CurrentWindow->GetID(str_id)); } -static void CloseInactivePopups(ImGuiWindow* ref_window) +void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window) { ImGuiContext& g = *GImGui; if (g.OpenPopupStack.empty()) diff --git a/imgui_internal.h b/imgui_internal.h index a00a88a09..37a31bff5 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -894,6 +894,7 @@ namespace ImGui IMGUI_API void OpenPopupEx(ImGuiID id); IMGUI_API void ClosePopup(ImGuiID id); + IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window); IMGUI_API bool IsPopupOpen(ImGuiID id); IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);