mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-13 18:50:58 +01:00
Misc: extracted ErrorCheckEndWindowRecover() out of ErrorCheckEndFrameRecover(). (#1651)
This commit is contained in:
parent
d366694062
commit
66cd21db88
43
imgui.cpp
43
imgui.cpp
@ -7316,11 +7316,37 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
while (g.CurrentWindowStack.Size > 0)
|
while (g.CurrentWindowStack.Size > 0)
|
||||||
{
|
{
|
||||||
|
ErrorCheckEndWindowRecover(log_callback, user_data);
|
||||||
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
if (g.CurrentWindowStack.Size == 1)
|
||||||
|
{
|
||||||
|
IM_ASSERT(window->IsFallbackWindow);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
IM_ASSERT(window == g.CurrentWindow);
|
||||||
|
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name);
|
||||||
|
EndChild();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (log_callback) log_callback(user_data, "Recovered from missing End() for '%s'", window->Name);
|
||||||
|
End();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must be called before End()/EndChild()
|
||||||
|
void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))
|
while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))
|
||||||
{
|
{
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'", g.CurrentTable->OuterWindow->Name);
|
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'", g.CurrentTable->OuterWindow->Name);
|
||||||
EndTable();
|
EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
IM_ASSERT(window != NULL);
|
IM_ASSERT(window != NULL);
|
||||||
while (g.CurrentTabBar != NULL) //-V1044
|
while (g.CurrentTabBar != NULL) //-V1044
|
||||||
@ -7368,23 +7394,6 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi
|
|||||||
if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name);
|
if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name);
|
||||||
PopFocusScope();
|
PopFocusScope();
|
||||||
}
|
}
|
||||||
if (g.CurrentWindowStack.Size == 1)
|
|
||||||
{
|
|
||||||
IM_ASSERT(g.CurrentWindow->IsFallbackWindow);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
IM_ASSERT(window == g.CurrentWindow);
|
|
||||||
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name);
|
|
||||||
EndChild();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing End() for '%s'", window->Name);
|
|
||||||
End();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save current stack sizes for later compare
|
// Save current stack sizes for later compare
|
||||||
|
@ -2681,6 +2681,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
|
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
||||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user