imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Unfocused floating viewports obscure docking node drop targets

Open WenchaoHuang opened this issue 1 year ago • 3 comments

Version/Branch of Dear ImGui:

docking

Back-ends:

Win32 + Vulkan

Compiler, OS:

Windows 10 + MSVC

Full config/build information:

No response

Details:

Docking icons render correctly when floating viewports are merged into the main viewport.

Screenshots/Video:

Image

Minimal, Complete and Verifiable Example code:

.\examples\example_win32_vulkan\main.cpp

io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows

... ImGui::NewFrame(); ImGui::DockSpaceOverViewport(); ...

WenchaoHuang avatar Mar 29 '25 04:03 WenchaoHuang

I'm not sure how to fix that, other than perhaps claiming focus on a viewport while holding on it (the same way you can open tree node or tabs by holding a drag and drop payload).

Note that by default the win32 backends creates a parent<>child relationship between main and secondary viewports, which effectively makes it impossible for that main viewport to appears in front of the others, but you can set io.ConfigViewportsNoDefaultParent = true to disable that behavior and then you can more easily reorder viewports.

ocornut avatar Mar 30 '25 12:03 ocornut

Is it technically feasible to implement docking node drop targets in a dedicated overlay window utilizing both Win32's WS_EX_LAYERED (for transparency effects) and WS_EX_TOPMOST extended styles?

WenchaoHuang avatar Mar 31 '25 09:03 WenchaoHuang

It would be a good solution to solve this and #2361.

However for this particular issue at hand, it would be ambiguous to show the overlay over the "Dear ImGui Demo" window because hovering in those locations wouldn't technically be hovering the target dockspace. It would be more correct to trigger focus on drag-hold but that requires backend to support unparenting (win32 backend does) + set io.ConfigViewportsNoDefaultParent (which we might decide to make the default).

ocornut avatar Mar 31 '25 09:03 ocornut