From 148bd34a7e8106cd6e8dae8411a506a8e3e84f40 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 25 Mar 2026 19:33:54 +0100 Subject: [PATCH] Viewports: add GetDebugName() helper. --- imgui.cpp | 6 ++++++ imgui.h | 1 + 2 files changed, 7 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 47b465c95..052f92a2f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -16539,6 +16539,12 @@ void ImGui::LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count) // - DestroyPlatformWindows() //----------------------------------------------------------------------------- +const char* ImGuiViewport::GetDebugName() const +{ + const ImGuiViewportP* viewport = (const ImGuiViewportP*)this; + return viewport->Window ? viewport->Window->Name : "n/a"; +} + void ImGuiPlatformIO::ClearPlatformHandlers() { Platform_GetClipboardTextFn = NULL; diff --git a/imgui.h b/imgui.h index ac297cbe6..88a71a9b4 100644 --- a/imgui.h +++ b/imgui.h @@ -4125,6 +4125,7 @@ struct ImGuiViewport // Helpers 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); } + IMGUI_API const char* GetDebugName() const; }; //-----------------------------------------------------------------------------