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

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