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.
features/potocpav-newer-lines-2
ocornut ago%!(EXTRA string=2 years)
parent 56a7b8b724
commit fa2e5710ac
  1. 3
      docs/CHANGELOG.txt
  2. 10
      imgui_widgets.cpp

@ -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]

@ -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…
Cancel
Save