Viewports: add GetDebugName() helper.

This commit is contained in:
ocornut
2026-03-25 19:33:54 +01:00
parent 8d8892ce0e
commit 148bd34a7e
2 changed files with 7 additions and 0 deletions

View File

@@ -16539,6 +16539,12 @@ void ImGui::LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count)
// - DestroyPlatformWindows() // - DestroyPlatformWindows()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const char* ImGuiViewport::GetDebugName() const
{
const ImGuiViewportP* viewport = (const ImGuiViewportP*)this;
return viewport->Window ? viewport->Window->Name : "n/a";
}
void ImGuiPlatformIO::ClearPlatformHandlers() void ImGuiPlatformIO::ClearPlatformHandlers()
{ {
Platform_GetClipboardTextFn = NULL; Platform_GetClipboardTextFn = NULL;

View File

@@ -4125,6 +4125,7 @@ struct ImGuiViewport
// Helpers // Helpers
ImVec2 GetCenter() const { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); } ImVec2 GetCenter() const { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
ImVec2 GetWorkCenter() const { return ImVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); } ImVec2 GetWorkCenter() const { return ImVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); }
IMGUI_API const char* GetDebugName() const;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------