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

Window grabbing issue after using BringWindowToDisplayFront #8247

Open
o-3-o opened this issue Dec 19, 2024 · 1 comment
Open

Window grabbing issue after using BringWindowToDisplayFront #8247

o-3-o opened this issue Dec 19, 2024 · 1 comment
Labels

Comments

@o-3-o
Copy link

o-3-o commented Dec 19, 2024

Version/Branch of Dear ImGui:

1.91.6

Back-ends:

imgui_impl_dx11.cpp + imgui_impl_win32.cpp

Compiler, OS:

win11+vs2022

Full config/build information:

No response

Details:

After using BringWindowToDisplayFront, other windows will flicker when they get the focus.

Although you can use ImGuiWindowFlags_NoBringToFrontOnFocus for other windows to solve this problem, it is too cumbersome to do so, so I don't know if this is a problem.

Screenshots/Video:

动画
动画

Minimal, Complete and Verifiable Example code:

        if (ImGui::Begin("CAPTION1"))
        {
            ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
        }
        ImGui::End();

        if (ImGui::Begin("CAPTION2"))
        {

        }
        ImGui::End();

//  I mainly hope that MainMenu will not be blocked by other windows:
//  Although you can use ImGuiWindowFlags_NoBringToFrontOnFocus for other windows to solve this problem, 
//  it is too cumbersome to do so, so I don't know if this is a problem.
        if (ImGui::BeginMainMenuBar())
        {
            ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());

            if (ImGui::BeginMenu("File"))
            {
                ImGui::EndMenu();
            }
            if (ImGui::BeginMenu("Edit"))
            {
                if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
                if (ImGui::MenuItem("Paste", "CTRL+V")) {}
                ImGui::EndMenu();
            }
            ImGui::EndMainMenuBar();

        }

        if (ImGui::Begin("CAPTION2"))
        {

        }
        ImGui::End();
@ocornut ocornut added the focus label Dec 19, 2024
@ocornut
Copy link
Owner

ocornut commented Dec 19, 2024

If you call this every frame other windows will temporarily fight for z-front.

There's no good solution for this as we don't have depth control yet. This is similar to #1328 which is not solved yet.

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