Skip to content

Commit

Permalink
TestEngine: for consistency, title bar / window items are registered …
Browse files Browse the repository at this point in the history
…in _Menu layer.
  • Loading branch information
ocornut committed Dec 18, 2024
1 parent 13c4084 commit f31d530
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7391,9 +7391,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
{
IM_ASSERT(window->IDStack.Size == 1);
window->IDStack.Size = 0; // As window->IDStack[0] == window->ID here, make sure TestEngine doesn't erroneously see window as parent of itself.
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
IMGUI_TEST_ENGINE_ITEM_ADD(window->ID, window->Rect(), NULL);
IMGUI_TEST_ENGINE_ITEM_INFO(window->ID, window->Name, (g.HoveredWindow == window) ? ImGuiItemStatusFlags_HoveredRect : 0);
window->IDStack.Size = 1;
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;

}
#endif

Expand Down Expand Up @@ -7653,7 +7656,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// [Test Engine] Register title bar / tab with MoveId.
#ifdef IMGUI_ENABLE_TEST_ENGINE
if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
{
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.ID, g.LastItemData.Rect, &g.LastItemData);
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
}
#endif
}
else
Expand Down

0 comments on commit f31d530

Please sign in to comment.