Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal popups no longer have a sensible minium size #7329

Closed
ZingBallyhoo opened this issue Feb 17, 2024 · 2 comments
Closed

Modal popups no longer have a sensible minium size #7329

ZingBallyhoo opened this issue Feb 17, 2024 · 2 comments

Comments

@ZingBallyhoo
Copy link

Version/Branch of Dear ImGui:

Version 1.90.4 WIP (19031), 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.4 WIP (19031)
--------------------------------
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:

Introduced in commit e2035a5 (part of 1.90.0)

Current version of culprit code:

imgui/imgui.cpp

Line 5683 in 8a14b71

if (window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow))

Very likely that Modals should be excluded from the small-size path.

Screenshots/Video:

Current Behavior Expected Behavior
2024-02-17.20-24-16.mp4
2024-02-17.20-26-40.mp4

Minimal, Complete and Verifiable Example code:

if (ImGui::Button("Open popup")) ImGui::OpenPopup("Popup");

ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 10); // to highlight rendering issues
if (ImGui::BeginPopupModal("Popup", nullptr, 0))
{
    if (ImGui::Button("Close")) ImGui::CloseCurrentPopup();
    ImGui::EndPopup();
}
ImGui::PopStyleVar();
ocornut added a commit to ocornut/imgui_test_engine that referenced this issue Feb 20, 2024
@ocornut
Copy link
Owner

ocornut commented Feb 20, 2024

Thank you @ZingBallyhoo for your detailed and accurate bug report (and the other one too).

I have pushed a fix e78ce72 + amended TestSuite (ocornut/imgui_test_engine@9ad4dee).

Basically the cases to consider are:

  • Window with ImGuiWindowFlags_Popup flag
    • BeginPopup() used ImGuiWindowFlags_AlwaysAutoResize anyway -> no change
    • BeginPopupEx() (internal) without auto-resize: FIXED
    • BeginPopupModal(): FIXED (what you reported)
  • Window with ImGuiWindowFlags_ChildMenu flag:
    • Always used ImGuiWindowFlags_AlwaysAutoResize, lead, to same case.
  • Window with ImGuiWindowFlags_ChildWindow:
    • ImGuiWindowFlags_AlwaysAutoResize is always
    • Kept code path for now. Essentially we want to know if manual resize is possible, we can talk tend toward that.

This aligns with the fact that in 623bff2 I noted that CalcWindowMinSize() should probably be simplified further.

@ocornut ocornut closed this as completed Feb 20, 2024
@ZingBallyhoo
Copy link
Author

Thanks for the fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants