diff --git a/docs/TODO.txt b/docs/TODO.txt index 4842ae0c..be4ef7cc 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -130,7 +130,9 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319) - dock: merge docking branch (#2109) - - dock: A~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete). this is mostly working but the DockBuilderXXX api are not exposed/finished. + - dock: B~ rework code to be able to lazily create tab bar instance in a single place. The _Unsorted tab flag could be replacing a trailing-counter in DockNode? + - dock: B~ fully track windows/settings reference in dock nodes. perhaps find a representation that allows facilitate use of dock builder functions. + - dock: B~ Unreal style document system (requires low-level controls of dockspace serialization fork/copy/delete). this is mostly working but the DockBuilderXXX api are not exposed/finished. - dock: B: when docking outer, perform size locking on neighbors nodes the same way we do it with splitters, so other nodes are not resized. - dock: B~ central node resizing behavior incorrect. - dock: B: changing title font/style per-window is not supported as dock nodes are created in NewFrame. diff --git a/imgui.cpp b/imgui.cpp index 2661b070..267ae676 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2587,6 +2587,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); LastFrameActive = -1; + LastFrameJustFocused = -1; ItemWidthDefault = 0.0f; FontWindowScale = FontDpiScale = 1.0f; SettingsIdx = -1; @@ -6070,7 +6071,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) g.NextWindowData.Clear(); if (window->DockIsActive && !window->DockTabIsVisible) - window->HiddenFramesCanSkipItems = 1; + { + if (window->LastFrameJustFocused == g.FrameCount) // This may be a better a generalization for the code in BeginDocked() setting the same field. + window->HiddenFramesCannotSkipItems = 1; + else + window->HiddenFramesCanSkipItems = 1; + } if (flags & ImGuiWindowFlags_ChildWindow) { @@ -6219,6 +6225,7 @@ void ImGui::FocusWindow(ImGuiWindow* window) // Passing NULL allow to disable keyboard focus if (!window) return; + window->LastFrameJustFocused = g.FrameCount; // Select in dock node if (window->DockNode && window->DockNode->TabBar) diff --git a/imgui_internal.h b/imgui_internal.h index e4a4ea22..9f735e6b 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1405,6 +1405,7 @@ struct IMGUI_API ImGuiWindow ImVec2ih HitTestHoleSize, HitTestHoleOffset; ImRect ContentsRegionRect; // FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis int LastFrameActive; // Last frame number the window was Active. + int LastFrameJustFocused; // Last frame number the window was made Focused. float ItemWidthDefault; ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items ImGuiStorage StateStorage;