ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.16k stars 10.31k forks source link

Topmost modal #7158

Open SuperWangKai opened 11 months ago

SuperWangKai commented 11 months ago

Version/Branch of Dear ImGui:

Version: XXX Branch: XXX (master/viewport/docking/etc.)

Back-end/Renderer/Compiler/OS

Dear ImGui 1.90.1 WIP (19002)
--------------------------------
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
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: 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

My Issue/Question:

For the docking branch, platform windows are on top of the main window. When we use modal, the platform window can cover and block the modal. This could totally block any user interaction. In my case, the modal window is used to confirm exit and it is always centered in the main window, in this case, if it is covered by any platform window, user cannot click on the buttons, causing an unusable situation.

Screenshots/Video image

SuperWangKai commented 11 months ago

Another question is how to make a modal on top of others. In the ImGui demo code, modal on top of another modal (Add another modal..) is demonstrated, however, in a more practical situation, like my exit confirmation popup, I could not embed it within other modals. How to make sure that the exit modal is always top most?

Thanks!