Internals: Begin: update ->Hidden flags only on first begin of the frame. (ignore whitespace to see simple diff)

# Conflicts:
#	imgui.cpp
This commit is contained in:
ocornut 2020-09-01 15:24:24 +02:00
parent 34077c0140
commit fc625d249f

View File

@ -5602,6 +5602,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
ImGuiWindowFlags flags = window->Flags; ImGuiWindowFlags flags = window->Flags;
// Ensure that ScrollBar doesn't read last frame's SkipItems // Ensure that ScrollBar doesn't read last frame's SkipItems
IM_ASSERT(window->BeginCount == 0);
window->SkipItems = false; window->SkipItems = false;
// Draw window + handle manual resize // Draw window + handle manual resize
@ -6626,6 +6627,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->BeginCount++; window->BeginCount++;
g.NextWindowData.ClearFlags(); g.NextWindowData.ClearFlags();
// Update visibility
if (first_begin_of_the_frame)
{
// When we are about to select this tab (which will only be visible on the _next frame_), flag it with a non-zero HiddenFramesCannotSkipItems. // 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 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. // This is analogous to regular windows being hidden from one frame.
@ -6667,8 +6671,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && window->HiddenFramesCannotSkipItems <= 0) if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && window->HiddenFramesCannotSkipItems <= 0)
skip_items = true; skip_items = true;
window->SkipItems = skip_items; window->SkipItems = skip_items;
}
return !skip_items; return !window->SkipItems;
} }
void ImGui::End() void ImGui::End()