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

How to prevent two different ImGuiWindowClass from docking within each-other #5653

Open
vassilcom opened this issue Sep 6, 2022 · 0 comments
Labels

Comments

@vassilcom
Copy link

vassilcom commented Sep 6, 2022

Version: 1.88 (commit : aceab9a8 / 5 Aug 2022)
Branch: docking

Linux Mint 20.2

I'm not sure if it's the right place for this issue - whether this is a bug or I'm missing something, but..

I'm trying to create two groups (window class) of dockable windows (left and right on the attached gif). Each window should dock only within its own group, and should not interact with the windows from the opposite group.

It works as expected till some point: as soon as windows are coupled, it/they become dockable with both, its own and opposite group (hope the gif will explain it better).

Is there any way to fix this issue, that is, to isolate those two groups from interacting between each-other?

docking

    {
    
        ImGuiWindowClass window_class1;
        window_class1.ClassId = ImGui::GetID("set1");
        window_class1.DockingAllowUnclassed = false;

        ImGui::SetNextWindowClass(&window_class1);
        ImGui::Begin("Window1_a");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();

        ImGui::SetNextWindowClass(&window_class1);
        ImGui::Begin("Window1_b");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();

        ImGui::SetNextWindowClass(&window_class1);
        ImGui::Begin("Window1_c");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();

        ImGui::SetNextWindowClass(&window_class1);
        ImGui::Begin("Window1_d");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();
    }

    {
        ImGuiWindowClass window_class2;
        window_class2.ClassId = ImGui::GetID("set2");
        window_class2.DockingAllowUnclassed = false;


        ImGui::SetNextWindowClass(&window_class2);
        ImGui::Begin("Window2_a");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());            
        }
        ImGui::End();

        ImGui::SetNextWindowClass(&window_class2);
        ImGui::Begin("Window2_b");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();

        ImGui::SetNextWindowClass(&window_class2);
        ImGui::Begin("Window2_c");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();

        ImGui::SetNextWindowClass(&window_class2);
        ImGui::Begin("Window2_d");
        {
            ImGui::Text("dock id %d", (int)ImGui::GetWindowDockID());
        }
        ImGui::End();
    }
@ocornut ocornut changed the title Ho to prevent two different ImGuiWindowClass from docking within each-other How to prevent two different ImGuiWindowClass from docking within each-other Sep 6, 2022
@ocornut ocornut added the docking label Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants