Internals: InitOrLoadWindowSettings() clear Size again for better data nuking in tests. Debug Log: added ImGuiDebugLogFlags_OutputToTestEngine flag.

This commit is contained in:
ocornut 2023-09-11 20:40:39 +02:00
parent bed492da70
commit 6eb2681c09
2 changed files with 8 additions and 2 deletions

View File

@ -5572,6 +5572,7 @@ static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* s
// Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window.
const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); const ImGuiViewport* main_viewport = ImGui::GetMainViewport();
window->Pos = main_viewport->Pos + ImVec2(60, 60); window->Pos = main_viewport->Pos + ImVec2(60, 60);
window->Size = window->SizeFull = ImVec2(0, 0);
window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;
if (settings != NULL) if (settings != NULL)
@ -14608,9 +14609,13 @@ void ImGui::DebugLogV(const char* fmt, va_list args)
const int old_size = g.DebugLogBuf.size(); const int old_size = g.DebugLogBuf.size();
g.DebugLogBuf.appendf("[%05d] ", g.FrameCount); g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
g.DebugLogBuf.appendfv(fmt, args); g.DebugLogBuf.appendfv(fmt, args);
g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size());
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY) if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size); IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size);
g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size()); #ifdef IMGUI_ENABLE_TEST_ENGINE
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine)
IMGUI_TEST_ENGINE_LOG("%s", g.DebugLogBuf.begin() + old_size);
#endif
} }
void ImGui::ShowDebugLogWindow(bool* p_open) void ImGui::ShowDebugLogWindow(bool* p_open)

View File

@ -1748,7 +1748,8 @@ enum ImGuiDebugLogFlags_
ImGuiDebugLogFlags_EventSelection = 1 << 5, ImGuiDebugLogFlags_EventSelection = 1 << 5,
ImGuiDebugLogFlags_EventIO = 1 << 6, ImGuiDebugLogFlags_EventIO = 1 << 6,
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO, ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO,
ImGuiDebugLogFlags_OutputToTTY = 1 << 10, // Also send output to TTY ImGuiDebugLogFlags_OutputToTTY = 1 << 10, // Also send output to TTY
ImGuiDebugLogFlags_OutputToTestEngine = 1 << 11, // Also send output to Test Engine
}; };
struct ImGuiMetricsConfig struct ImGuiMetricsConfig