Repository: ocornut/imgui

Issue #7287: Child-menus no longer attempt to fit inside the viewport
Created: 2024-02-02T23:39:05Z
Version/Branch of Dear ImGui:
Version 1.90.2 WIP (19016), Branch: master
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler, OS:
Windows 10 + MSVC
Full config/build information:
Dear ImGui 1.90.2 WIP (19016)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1938
define: _MSVC_LANG=201402
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000003
 NavEnableKeyboard
 NavEnableGamepad
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000000E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1264.00,761.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:
My Issue/Question:
As of 1.90.1 child menus no longer attempt to fit inside of the viewport. Root menus still work correctly.
Introduced in commit f37f6f6 (Related issue: #7063)
Screenshots/Video:



Previous behavior
Current behavior









Minimal, Complete and Verifiable Example code:
if (ImGui::BeginMainMenuBar())
{
    if (ImGui::BeginMenu("Menu"))
    {
        if (ImGui::BeginMenu("Submenu"))
        {
            for (int i = 0; i < 50; ++i)
            {
                ImGui::Text("hello!");
            }
            ImGui::EndMenu();
        }
        ImGui::EndMenu();
    }
    ImGui::EndMainMenuBar();
}
Can also be seen on the demo submenus (e.g Menu->Colors)

Duplicate issue #7730: Menu window size is erroneously clamped to main viewport size
Created: 2024-06-24T07:15:14Z
Version/Branch of Dear ImGui:
Version 1.90.8, Branch: docking
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx12.cpp
Compiler, OS:
Windows 10 + MSVC 2022
Full config/build information:
Dear ImGui 1.90.8 (19080)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1940
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx12
io.ConfigFlags: 0x00000443
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 120.00,11.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:
Hi!
There is an issue related only to the docking branch with the function CalcWindowAutoFitSize
It's always using the main viewport to define the size_max in some cases. One at least is happening here:

pop out the "Dear ImGui Demo" window
resize the main window until it has the smallest size possible
open "Menu" in the "Dear ImGui Demo"
go to any menu item with context such "Open Recent"

Thank you!
Screenshots/Video:

Minimal, Complete and Verifiable Example code:
No response

Closing comment (2024-06-24T20:33:49Z): Related to #7287, #7063