Alternative fix for bug introduced in d845135 (#1651), fix CTRL+Tab and fallback tooltip.

This commit is contained in:
omar 2019-01-02 22:52:09 +01:00
parent 3e30bfd6c9
commit b3469fa94b
2 changed files with 12 additions and 7 deletions

View File

@ -3349,6 +3349,7 @@ void ImGui::NewFrame()
// This fallback is particularly important as it avoid ImGui:: calls from crashing.
SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver);
Begin("Debug##Default");
g.FrameScopePushedImplicitWindow = true;
#ifdef IMGUI_ENABLE_TEST_ENGINE
ImGuiTestEngineHook_PostNewFrame();
@ -3580,9 +3581,6 @@ void ImGui::EndFrame()
return;
IM_ASSERT(g.FrameScopeActive && "Forgot to call ImGui::NewFrame()?");
g.FrameScopeActive = false;
g.FrameCountEnded = g.FrameCount;
// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f)
{
@ -3607,11 +3605,12 @@ void ImGui::EndFrame()
}
// Hide implicit/fallback "Debug" window if it hasn't been used
g.FrameScopePushedImplicitWindow = false;
if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
g.CurrentWindow->Active = false;
End();
// Show CTRL+TAB list
// Show CTRL+TAB list window
if (g.NavWindowingTarget)
NavUpdateWindowingList();
@ -3632,6 +3631,10 @@ void ImGui::EndFrame()
g.DragDropWithinSourceOrTarget = false;
}
// End frame
g.FrameScopeActive = false;
g.FrameCountEnded = g.FrameCount;
// Initiate moving window
if (g.ActiveId == 0 && g.HoveredId == 0)
{
@ -5283,11 +5286,12 @@ void ImGui::End()
{
ImGuiContext& g = *GImGui;
if (g.CurrentWindowStack.Size <= 1 && g.FrameScopeActive)
if (g.CurrentWindowStack.Size <= 1 && g.FrameScopePushedImplicitWindow)
{
IM_ASSERT(g.CurrentWindowStack.Size > 1 && "Calling End() too many times!");
return; // FIXME-ERRORHANDLING
}
IM_ASSERT(g.CurrentWindowStack.Size > 0);
ImGuiWindow* window = g.CurrentWindow;

View File

@ -694,7 +694,8 @@ struct ImGuiTabBarSortItem
struct ImGuiContext
{
bool Initialized;
bool FrameScopeActive; // Set by NewFrame(), cleared by EndFrame()/Render()
bool FrameScopeActive; // Set by NewFrame(), cleared by EndFrame()
bool FrameScopePushedImplicitWindow; // Set by NewFrame(), cleared by EndFrame()
bool FontAtlasOwnedByContext; // Io.Fonts-> is owned by the ImGuiContext and will be destructed along with it.
ImGuiIO IO;
ImGuiStyle Style;
@ -859,7 +860,7 @@ struct ImGuiContext
ImGuiContext(ImFontAtlas* shared_font_atlas) : OverlayDrawList(NULL)
{
Initialized = false;
FrameScopeActive = false;
FrameScopeActive = FrameScopePushedImplicitWindow = false;
Font = NULL;
FontSize = FontBaseSize = 0.0f;
FontAtlasOwnedByContext = shared_font_atlas ? false : true;