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

Modal is closed when doing an Alt-Tab to another window not in its hierarchy #6357

Closed
arnaud-neny opened this issue Apr 21, 2023 · 2 comments

Comments

@arnaud-neny
Copy link

Version/Branch of Dear ImGui:

Version: 1.89.5
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx12.cpp
Compiler: VS 2022
Operating System: Windows 10

My Issue/Question:

When having a popup modal opened in a separate window, and it has not having the focus, doing a alt-tab to another window not in its hierarchy is getting it closed.
(Open the demo, open a "Delete..." modal, make all windows popped out, click on the main window, Alt-Tab to "Dear ImGui Window", and the modal get closed).

@ocornut
Copy link
Owner

ocornut commented Apr 21, 2023

Seems like a regression caused by #6299 (comment)
Working on it!

@ocornut ocornut added the bug label Apr 21, 2023
ocornut added a commit that referenced this issue Apr 21, 2023
…uestFlags_UnlessBelowModal (currently opt-in, should try to make opt-out). (#6357, #4317)
ocornut added a commit that referenced this issue Apr 21, 2023
…usRequestFlags_RestoreFocusedChild flag. (#6357)

# Conflicts:
#	imgui.cpp
ocornut added a commit that referenced this issue Apr 21, 2023
…t-most below the modal, simplify code in Begin(). (#6357, #4317)
ocornut added a commit that referenced this issue Apr 21, 2023
…ally closing modals (#6299, #6357)

+ Fixed double-assignment static analyzer warning.

# Conflicts:
#	imgui.cpp
@ocornut
Copy link
Owner

ocornut commented Apr 21, 2023

I have pushed a fix for this, it comes a series of commits, mainly 30eceaf, 01ca196, 4d42450, ending with d76699b d2291df .

There was a much needed refactor of whose responsibility it is to check for the presence of blocking modal before a focus change and this allowed me to start doing this refactor. I think there's more to do on that topic (other than your specific issue) but I will need to wait until we have a more serious battery of regression tests around this.

Specifically, my general plan is:

  • The newly added ImGuiFocusRequestFlags_UnlessBelowModal flag should probably be made opposite to be opt-out instead of opt-in. But we'll need to double check and add regression tests for as many FocusWindow() calling paths as possible before.
  • This should eventually be exposed into public facing API such as SetNextWindowFocus().

@ocornut ocornut closed this as completed Apr 21, 2023
ocornut added a commit that referenced this issue Apr 21, 2023
…ally closing modals (#6299, #6357)

+ Fixed double-assignment static analyzer warning.

# Conflicts:
#	imgui.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants