Skip to content

Mixing top level windows and dock windows #3152

@dgregorius

Description

@dgregorius

Version/Branch of Dear ImGui:

Version: 17601
Branch: docking

Back-ends: imgui_impl_glfw.cpp +imgui_impl_opengl3.cpp _
Compiler: VS 2019
Operating System: Windows 10

My Issue/Question:

I have an application which consists of several top level windows and each top level window consists of several dock windows. I would like the top level windows have an OS title bar and no auto merge when they overlap. The dock widgets on the other hand should have no decoration and can auto merge.

It seems I can have either one or the other. E.g. if I initialize Dear ImGUI like below get the correct top level behavior, but the dock windows are wrong:

ImGuiIO& IO = ImGui::GetIO();
IO.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
IO.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
IO.ConfigViewportsNoAutoMerge = true;     
IO.ConfigViewportsNoTaskBarIcon = false;    
IO.ConfigViewportsNoDecoration = false; 
IO.ConfigViewportsNoDefaultParent = true;

If I use the defaults, the dock windows are correct, but the top level window are not working as expected

ImGuiIO& IO = ImGui::GetIO();
IO.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
IO.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
IO.ConfigViewportsNoAutoMerge = false;     
IO.ConfigViewportsNoTaskBarIcon = false;    
IO.ConfigViewportsNoDecoration = true; 
IO.ConfigViewportsNoDefaultParent = false;

Is their a way to specify the above flags per window instead of globally? I think this would solve my issue. It would be nice to have this kind of control I think. In particular since the functionality seems to be already there

Another option would be to create several OS windows myself (in my case with GLFW) and then bind my OS windows to a specific viewport. Unfortunately it seems I cannot create viewports for OS windows myself or find them if they would be auto created.

Finally I was thinking to use a context for each top level window, but again I cannot pass the associated window/viewport.

Any suggestion are welcome!

Screenshots/Video

The correct top level behavior

Capture1

Incorrect docking windows. The 'Console' window is a docking window and should not have the OS title bar.

Capture2

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions