From ff45cb5929b478f0b1d37738b35ec30b9de2d216 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 5 Nov 2025 18:40:05 +0100 Subject: [PATCH] Viewports: rename FindViewportByID() parameter for clarity. --- imgui.cpp | 4 ++-- imgui.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 778261ba1..d1c161cb7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -16356,11 +16356,11 @@ ImGuiViewport* ImGui::GetMainViewport() } // FIXME: This leaks access to viewports not listed in PlatformIO.Viewports[]. Problematic? (#4236) -ImGuiViewport* ImGui::FindViewportByID(ImGuiID id) +ImGuiViewport* ImGui::FindViewportByID(ImGuiID viewport_id) { ImGuiContext& g = *GImGui; for (ImGuiViewportP* viewport : g.Viewports) - if (viewport->ID == id) + if (viewport->ID == viewport_id) return viewport; return NULL; } diff --git a/imgui.h b/imgui.h index a146d210a..cd69e75e2 100644 --- a/imgui.h +++ b/imgui.h @@ -1180,7 +1180,7 @@ namespace ImGui IMGUI_API void UpdatePlatformWindows(); // call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport. IMGUI_API void RenderPlatformWindowsDefault(void* platform_render_arg = NULL, void* renderer_render_arg = NULL); // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs. IMGUI_API void DestroyPlatformWindows(); // call DestroyWindow platform functions for all viewports. call from backend Shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext(). - IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID id); // this is a helper for backends. + IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID viewport_id); // this is a helper for backends. IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle); // this is a helper for backends. the type platform_handle is decided by the backend (e.g. HWND, MyWindow*, GLFWwindow* etc.) } // namespace ImGui