Don't bring appearing host window to front unless any of the contained… #7116
+18
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… windows require initial focus
I took a closer look at how to implement the "officially" suggested fix for one of the problems in #7008, specifically this one:
The fix was surprisingly easy since all of the needed information is available right there. If the host window is appearing, instead of just bringing it to the front, it now checks its contained appearing windows first and is brought to the front only if one (or more) of the contained appearing windows has
ImGuiWindowFlags_NoFocusOnAppearing
not set (thus requiring initial focus).This fix makes the behavior of appearing windows consistent regardless of how they may be docked. Here are some GIFs of the before and after behavior. Ctrl+Click is custom functionality through wrappers (no library change) for "sticky" menu items. They keep the menu open while appearing windows get the
ImGuiWindowFlags_NoFocusOnAppearing
flag.Normal click closes the menu and opens the window without the flag, the behavior is not changed by the fix:
Ctrl+Click keeps the menu open, window gets the flag, but host window gets brought to the front anyway without the fix:
Ctrl+Click with the fix results in the desired behavior: