From 174f37bdaf87aff066f0332778dcfee016b44073 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 23 Jul 2025 16:17:35 +0900 Subject: [PATCH] Fixed building with IMGUI_DISABLE_DEBUG_TOOLS only. (#8796) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 586cd831b..3c2e13300 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -48,6 +48,7 @@ Other Changes: selected), impacting code not checking for BeginChild() return value. (#8815) - Error Handling: minor improvements to error handling for TableGetSortSpecs() and TableSetBgColor() calls. (#1651, #8499) +- Misc: fixed building with IMGUI_DISABLE_DEBUG_TOOLS only. (#8796) - Misc: removed more redundant inline static linkage from imgui_internal.h to facilitate using in C++ modules. (#8813, #8682, #8358) [@stripe2933] - CI: Added SDL3 builds to MacOS and Windows. (#8819, #8778) [@scribam] diff --git a/imgui.cpp b/imgui.cpp index 769fd44df..918105f26 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -15665,10 +15665,14 @@ static void Platform_SetImeDataFn_DefaultImpl(ImGuiContext*, ImGuiViewport*, ImG //----------------------------------------------------------------------------- // [SECTION] METRICS/DEBUGGER WINDOW //----------------------------------------------------------------------------- +// - MetricsHelpMarker() [Internal] // - DebugRenderViewportThumbnail() [Internal] // - RenderViewportsThumbnails() [Internal] +// - DebugRenderKeyboardPreview() [Internal] // - DebugTextEncoding() -// - MetricsHelpMarker() [Internal] +// - DebugFlashStyleColorStop() [Internal] +// - DebugFlashStyleColor() +// - UpdateDebugToolFlashStyleColor() [Internal] // - ShowFontAtlas() [Internal but called by Demo!] // - DebugNodeTexture() [Internal] // - ShowMetricsWindow() @@ -15686,6 +15690,21 @@ static void Platform_SetImeDataFn_DefaultImpl(ImGuiContext*, ImGuiViewport*, ImG // - DebugNodeWindowsListByBeginStackParent() [Internal] //----------------------------------------------------------------------------- +#if !defined(IMGUI_DISABLE_DEMO_WINDOWS) || !defined(IMGUI_DISABLE_DEBUG_TOOLS) +// Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds. +static void MetricsHelpMarker(const char* desc) +{ + ImGui::TextDisabled("(?)"); + if (ImGui::BeginItemTooltip()) + { + ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); + ImGui::TextUnformatted(desc); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } +} +#endif + #ifndef IMGUI_DISABLE_DEBUG_TOOLS void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb) @@ -15874,19 +15893,6 @@ static const char* FormatTextureIDForDebugDisplay(char* buf, int buf_size, const return FormatTextureIDForDebugDisplay(buf, (int)(buf_end - buf), cmd->TexRef.GetTexID()); // Calling TexRef::GetTexID() to avoid assert of cmd->GetTexID() } -// Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds. -static void MetricsHelpMarker(const char* desc) -{ - ImGui::TextDisabled("(?)"); - if (ImGui::BeginItemTooltip()) - { - ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); - ImGui::TextUnformatted(desc); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); - } -} - #ifdef IMGUI_ENABLE_FREETYPE namespace ImGuiFreeType { IMGUI_API const ImFontLoader* GetFontLoader(); IMGUI_API bool DebugEditFontLoaderFlags(unsigned int* p_font_builder_flags); } #endif