|
|
@ -8204,7 +8204,7 @@ void ImGui::OpenPopupEx(ImGuiID id)
|
|
|
|
popup_ref.OpenPopupPos = NavCalcPreferredRefPos();
|
|
|
|
popup_ref.OpenPopupPos = NavCalcPreferredRefPos();
|
|
|
|
popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos;
|
|
|
|
popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos;
|
|
|
|
|
|
|
|
|
|
|
|
//IMGUI_DEBUG_LOG("OpenPopupEx(0x%08X)\n", g.FrameCount, id);
|
|
|
|
IMGUI_DEBUG_LOG_POPUP("OpenPopupEx(0x%08X)\n", id);
|
|
|
|
if (g.OpenPopupStack.Size < current_stack_size + 1)
|
|
|
|
if (g.OpenPopupStack.Size < current_stack_size + 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g.OpenPopupStack.push_back(popup_ref);
|
|
|
|
g.OpenPopupStack.push_back(popup_ref);
|
|
|
@ -8265,7 +8265,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below
|
|
|
|
if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//IMGUI_DEBUG_LOG("ClosePopupsOverWindow(%s) -> ClosePopupToLevel(%d)\n", ref_window->Name, popup_count_to_keep);
|
|
|
|
IMGUI_DEBUG_LOG_POPUP("ClosePopupsOverWindow(\"%s\") -> ClosePopupToLevel(%d)\n", ref_window->Name, popup_count_to_keep);
|
|
|
|
ClosePopupToLevel(popup_count_to_keep, restore_focus_to_window_under_popup);
|
|
|
|
ClosePopupToLevel(popup_count_to_keep, restore_focus_to_window_under_popup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -8273,6 +8273,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
|
|
|
|
void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
|
|
|
|
void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
|
|
|
IMGUI_DEBUG_LOG_POPUP("ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n", remaining, restore_focus_to_window_under_popup);
|
|
|
|
IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
|
|
|
|
IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
|
|
|
|
ImGuiWindow* focus_window = g.OpenPopupStack[remaining].SourceWindow;
|
|
|
|
ImGuiWindow* focus_window = g.OpenPopupStack[remaining].SourceWindow;
|
|
|
|
ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window;
|
|
|
|
ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window;
|
|
|
@ -8315,7 +8316,7 @@ void ImGui::CloseCurrentPopup()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
popup_idx--;
|
|
|
|
popup_idx--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//IMGUI_DEBUG_LOG("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx);
|
|
|
|
IMGUI_DEBUG_LOG_POPUP("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx);
|
|
|
|
ClosePopupToLevel(popup_idx, true);
|
|
|
|
ClosePopupToLevel(popup_idx, true);
|
|
|
|
|
|
|
|
|
|
|
|
// A common pattern is to close a popup when selecting a menu item/selectable that will open another window.
|
|
|
|
// A common pattern is to close a popup when selecting a menu item/selectable that will open another window.
|
|
|
|