mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 22:26:34 +00:00
Docking: Remove code in BeginDocked() to set HiddenFramesCannotSkipItems based on upcoming tab bar selection, solely based on focus (might break something subtle?). Follow-up to c355ed1267
. (#2453, #2109)
This commit is contained in:
parent
b6ae8a0dca
commit
47219dd5c6
14
imgui.cpp
14
imgui.cpp
@ -6070,9 +6070,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->BeginCount++;
|
window->BeginCount++;
|
||||||
g.NextWindowData.Clear();
|
g.NextWindowData.Clear();
|
||||||
|
|
||||||
|
// When we are about to select this tab (which will only be visible on the _next frame_), flag it with a non-zero HiddenFramesCannotSkipItems.
|
||||||
|
// This will have the important effect of actually returning true in Begin() and not setting SkipItems, allowing an earlier submission of the window contents.
|
||||||
|
// This is analogous to regular windows being hidden from one frame.
|
||||||
|
// It is especially important as e.g. nested TabBars would otherwise generate flicker in the form of one empty frame, or focus requests won't be processed.
|
||||||
if (window->DockIsActive && !window->DockTabIsVisible)
|
if (window->DockIsActive && !window->DockTabIsVisible)
|
||||||
{
|
{
|
||||||
if (window->LastFrameJustFocused == g.FrameCount) // This may be a better a generalization for the code in BeginDocked() setting the same field.
|
if (window->LastFrameJustFocused == g.FrameCount)
|
||||||
window->HiddenFramesCannotSkipItems = 1;
|
window->HiddenFramesCannotSkipItems = 1;
|
||||||
else
|
else
|
||||||
window->HiddenFramesCanSkipItems = 1;
|
window->HiddenFramesCanSkipItems = 1;
|
||||||
@ -13527,14 +13531,6 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
|
|||||||
if (node->VisibleWindow == window)
|
if (node->VisibleWindow == window)
|
||||||
window->DockTabIsVisible = true;
|
window->DockTabIsVisible = true;
|
||||||
|
|
||||||
// When we are about to select this tab (which will only be visible on the _next frame_), flag it with a non-zero HiddenFramesCannotSkipItems.
|
|
||||||
// This will have the important effect of actually returning true in Begin() and not setting SkipItems, allowing an earlier submission of the window contents.
|
|
||||||
// This is analogous to regular windows being hidden from one frame. It is especially important as nested TabBars would otherwise generate flicker in the form
|
|
||||||
// of one empty frame.
|
|
||||||
// Note that we set HiddenFramesCannotSkipItems=2 because BeginDocked() is called just before Begin() has a chance to decrement the value. Effectively it'll be a 1 frame thing.
|
|
||||||
if (!window->DockTabIsVisible && node->TabBar && node->TabBar->NextSelectedTabId == window->ID)
|
|
||||||
window->HiddenFramesCannotSkipItems = 2;
|
|
||||||
|
|
||||||
// Update window flag
|
// Update window flag
|
||||||
IM_ASSERT((window->Flags & ImGuiWindowFlags_ChildWindow) == 0);
|
IM_ASSERT((window->Flags & ImGuiWindowFlags_ChildWindow) == 0);
|
||||||
window->Flags |= ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_NoResize;
|
window->Flags |= ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_NoResize;
|
||||||
|
Loading…
Reference in New Issue
Block a user