Skip to content

Wrong z-order with ImGuiViewportFlags_NoAutoMerge and owned windows #4665

@RT2Code

Description

@RT2Code

Version/Branch of Dear ImGui:

Version: 1.85
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: custom engine
Compiler: MSVC v14.29
Operating System: Windows 10

My Issue/Question:

I use a custom backend for my engine where child windows are owned by the main window, like in the win32 backend. It means that child windows are always displayed over the main window, independently of the current focused window. I don't specify the ImGuiBackendFlags_HasMouseHoveredViewport flag and let ImGUI compute the current hovered viewport.

It works fine until I create a child window with the ImGuiViewportFlags_NoAutoMerge flag. If this window is placed over the main viewport, and we gives focus to the latter, ImGUI will suppose that it is now under the main viewport, which is wrong because it's an owned window and it's still drawn at the top, and mouse hovering won't work for it.

I think we need a way to tell ImGUI that child windows are owned to allow it to compute the z-order accordingly.

Screenshots/Video

ezgif-3-e5c759eb2312

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions