From 221f36e11690466a0e528d88bacda16cf43ce330 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 2 May 2015 17:54:25 +0100 Subject: [PATCH] Comments, tweaks, metrics window tweak --- imgui.cpp | 9 +++------ imgui.h | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 9df10b3f0..115b54845 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3154,6 +3154,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ window->DrawList->Clear(); window->ClipRectStack.resize(0); window->LastFrameDrawn = current_frame; + window->IDStack.resize(1); } // Setup texture, outer clipping rectangle @@ -3191,9 +3192,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ window->SizeFull = size_on_first_use; } - // Reset ID stack - window->IDStack.resize(1); - // Move window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows. RegisterAliveId(window->MoveID); if (g.ActiveId == window->MoveID) @@ -3335,7 +3333,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ ImU32 resize_col = 0; if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFrames <= 0 && !(flags & ImGuiWindowFlags_NoResize)) { - // Manual resize grip + // Manual resize const ImRect resize_rect(window->Rect().GetBR()-ImVec2(14,14), window->Rect().GetBR()); const ImGuiID resize_id = window->GetID("#RESIZE"); bool hovered, held; @@ -3355,7 +3353,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ } else if (held) { - // Resize window->SizeFull = ImMax(window->SizeFull + g.IO.MouseDelta, style.WindowMinSize); if (!(flags & ImGuiWindowFlags_NoSavedSettings)) MarkSettingsDirty(); @@ -10731,7 +10728,7 @@ void ImGui::ShowMetricsWindow(bool* opened) static void NodeWindow(ImGuiWindow* window, const char* label) { - if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active, window)) + if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window)) return; NodeDrawList(window->DrawList, "DrawList"); if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); diff --git a/imgui.h b/imgui.h index 6c2b4a3fe..2357dd402 100644 --- a/imgui.h +++ b/imgui.h @@ -159,7 +159,7 @@ namespace ImGui IMGUI_API void ShowUserGuide(); // help block IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features - IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window + IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window for debugging imgui // Window // See implementation in .cpp for details