From ba14c70b020038bd580ab72da5181f03df4eb872 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 27 Sep 2024 19:23:41 +0200 Subject: [PATCH] Comments. Fixed warnings. --- imgui.cpp | 2 ++ imgui_demo.cpp | 5 ++++- imgui_internal.h | 9 ++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 5379248c8..0bfbff945 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -10452,6 +10452,8 @@ static void ImGui::ErrorCheckEndFrameSanityChecks() // while still correctly asserting on mid-frame key press events. ImGuiContext& g = *GImGui; const ImGuiKeyChord key_mods = GetMergedModsFromKeys(); + IM_UNUSED(g); + IM_UNUSED(key_mods); IM_ASSERT((key_mods == 0 || g.IO.KeyMods == key_mods) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); IM_UNUSED(key_mods); diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 60d944657..feaee3be9 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -545,8 +545,9 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::SameLine(); HelpMarker("Swap Cmd<>Ctrl keys, enable various MacOS style behaviors."); ImGui::Text("Also see Style->Rendering for rendering options."); - // Read https://github.com/ocornut/imgui/wiki/Error-Handling + // Also read: https://github.com/ocornut/imgui/wiki/Error-Handling ImGui::SeparatorText("Error Handling"); + ImGui::Checkbox("io.ConfigErrorRecovery", &io.ConfigErrorRecovery); ImGui::SameLine(); HelpMarker( "Options to configure how we handle recoverable errors.\n" @@ -561,6 +562,7 @@ void ImGui::ShowDemoWindow(bool* p_open) if (!io.ConfigErrorRecoveryEnableAssert && !io.ConfigErrorRecoveryEnableDebugLog && !io.ConfigErrorRecoveryEnableTooltip) io.ConfigErrorRecoveryEnableAssert = io.ConfigErrorRecoveryEnableDebugLog = io.ConfigErrorRecoveryEnableTooltip = true; + // Also read: https://github.com/ocornut/imgui/wiki/Debug-Tools ImGui::SeparatorText("Debug"); ImGui::Checkbox("io.ConfigDebugIsDebuggerPresent", &io.ConfigDebugIsDebuggerPresent); ImGui::SameLine(); HelpMarker("Enable various tools calling IM_DEBUG_BREAK().\n\nRequires a debugger being attached, otherwise IM_DEBUG_BREAK() options will appear to crash your application."); @@ -595,6 +597,7 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &io.BackendFlags, ImGuiBackendFlags_HasSetMousePos); ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &io.BackendFlags, ImGuiBackendFlags_RendererHasVtxOffset); ImGui::EndDisabled(); + ImGui::TreePop(); ImGui::Spacing(); } diff --git a/imgui_internal.h b/imgui_internal.h index cb9071478..80bba6903 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1887,15 +1887,14 @@ struct ImGuiLocEntry // Macros used by Recoverable Error handling // - Only dispatch error if _EXPR: evaluate as assert (similar to an assert macro). // - The message will always be a string literal, in order to increase likelihood of being display by an assert handler. -// - The intent is that you may rewire this macro to dispatch dynamically: -// - On programmers machines, when debugger is attached, on direct imgui API usage error: always assert! -// - On exception recovery and script language recovery: you may decide to error log. +// - See 'Demo->Configuration->Error Handling' and ImGuiIO definitions for details on error handling. +// - Read https://github.com/ocornut/imgui/wiki/Error-Handling for details on error handling. #ifndef IM_ASSERT_USER_ERROR #define IM_ASSERT_USER_ERROR(_EXPR,_MSG) do { if (!(_EXPR) && ImGui::ErrorLog(_MSG)) { IM_ASSERT((_EXPR) && _MSG); } } while (0) // Recoverable User Error #endif - -typedef void (*ImGuiErrorCallback)(ImGuiContext* ctx, void* user_data, const char* msg); // Function signature for g.ErrorCallback +// The error callback is currently not public, as it is expected that only advanced users will rely on it. +typedef void (*ImGuiErrorCallback)(ImGuiContext* ctx, void* user_data, const char* msg); // Function signature for g.ErrorCallback //----------------------------------------------------------------------------- // [SECTION] Metrics, Debug Tools