mirror of https://github.com/ocornut/imgui
MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously egister contents size. (#6789)
In dire need of removing BeginGroup()/EndGroup() from menu-bar code, fo r sanity.
This commit is contained in:
parent
56a7b8b724
commit
fa2e5710ac
|
@ -47,6 +47,9 @@ Other changes:
|
|||
- InputTextMultiline: Fixed a crash pressing Down on last empty line of a multiline buffer.
|
||||
(regression from 1.89.2, only happened in some states). (#6783, #6000)
|
||||
- BeginListBox(): Fixed not consuming SetNextWindowXXX data when returning false.
|
||||
- MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously
|
||||
register contents size in a way that would affect the scrolling layer.
|
||||
Was most often noticable when using an horizontal scrollbar. (#6789)
|
||||
- Backends: GLFW: Clear emscripten's MouseWheel callback before shutdown. (#6790, #6096, #4019) [@halx99]
|
||||
|
||||
|
||||
|
|
|
@ -1868,14 +1868,14 @@ struct ImGuiContext
|
|||
ImGuiNextWindowData NextWindowData; // Storage for SetNextWindow** functions
|
||||
|
||||
// Shared stacks
|
||||
ImVector<ImGuiColorMod> ColorStack; // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()
|
||||
ImVector<ImGuiStyleMod> StyleVarStack; // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()
|
||||
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont() - inherited by Begin()
|
||||
ImVector<ImGuiID> FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
|
||||
ImVector<ImGuiItemFlags>ItemFlagsStack; // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
|
||||
ImVector<ImGuiGroupData>GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||
ImVector<ImGuiPopupData>OpenPopupStack; // Which popups are open (persistent)
|
||||
ImVector<ImGuiPopupData>BeginPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
||||
ImVector<ImGuiColorMod> ColorStack; // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()
|
||||
ImVector<ImGuiStyleMod> StyleVarStack; // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()
|
||||
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont() - inherited by Begin()
|
||||
ImVector<ImGuiID> FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
|
||||
ImVector<ImGuiItemFlags> ItemFlagsStack; // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
|
||||
ImVector<ImGuiGroupData> GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||
ImVector<ImGuiPopupData> OpenPopupStack; // Which popups are open (persistent)
|
||||
ImVector<ImGuiPopupData> BeginPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
||||
ImVector<ImGuiNavTreeNodeData> NavTreeNodeStack; // Stack for TreeNode() when a NavLeft requested is emitted.
|
||||
|
||||
int BeginMenuCount;
|
||||
|
|
|
@ -7035,12 +7035,18 @@ void ImGui::EndMenuBar()
|
|||
PopClipRect();
|
||||
PopID();
|
||||
window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->Pos.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.
|
||||
g.GroupStack.back().EmitItem = false;
|
||||
EndGroup(); // Restore position on layer 0
|
||||
|
||||
// FIXME: Extremely confusing, cleanup by (a) working on WorkRect stack system (b) not using a Group confusingly here.
|
||||
ImGuiGroupData& group_data = g.GroupStack.back();
|
||||
group_data.EmitItem = false;
|
||||
ImVec2 restore_cursor_max_pos = group_data.BackupCursorMaxPos;
|
||||
window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, window->DC.CursorMaxPos.x - window->Scroll.x); // Convert ideal extents for scrolling layer equivalent.
|
||||
EndGroup(); // Restore position on layer 0 // FIXME: Misleading to use a group for that backup/restore
|
||||
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
||||
window->DC.IsSameLine = false;
|
||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||
window->DC.MenuBarAppending = false;
|
||||
window->DC.CursorMaxPos = restore_cursor_max_pos;
|
||||
}
|
||||
|
||||
// Important: calling order matters!
|
||||
|
|
Loading…
Reference in New Issue