1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-15 19:43:28 +01:00

Docking: Disable SkipItems when directly/programmatically focused (possible generalization of code currently in BeginDocked which relies on tab bar interaction, will remove that code in next commit). (#2453, #2109)

This commit is contained in:
omar 2019-03-28 16:04:00 +01:00
parent a33d45d7cd
commit b6ae8a0dca
3 changed files with 12 additions and 2 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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;