-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Need Official way to set/clear ImGuiViewportFlags_CanHostOtherWindows #4520
Comments
I think the solution would be:
|
The opposite is you can force an individual window to always claim its own viewport. It's labelled as
|
We want to let other windows merge with each other as they wish, so NoAutoMerge won't work. It's really the main window that is special. Calling SetNextWindowViewport does seem to give us the desired behaviour, where only the windows we want are merged into the main one, which is a lot nicer than changing viewport flags ! So that leaves the first part, of clearing that flag in the initialization... Thanks! |
I think there might a confusion. Windows don't "merge with other" unless you are talking about Docking features. A viewport (displayed in a platform window) can host multiple imgui windows. ( Consider reading https://github.com/ocornut/imgui/wiki/Glossary and patching all occurrence of "window" to use precise terms such as "platform window" or "imgui window" or "viewport", it tends to help for those threads where there can be ambiguities.
Would |
Actually the name of io.ConfigViewportsNoAutoMerge is conceptually almost "don't set |
Sorry for the confusion. Yes, we are using the docking branch, but this isn't about actually docking. It's about whether windows are allowed to use the main viewport when their rect is encompassed by it. ConfigViewportsNoAutoMerge is global, and makes each window always create their own viewport. We want to allow two imgui windows A and B that fully overlap use the same viewport. We just don't want them to try to use the main viewport. That is, except for a few specific imgui windows that we deliberately place overlapping the main viewport, and we want those to use the main viewport and not create their own, because we want them to move with the main window. Calling SetNextWindowViewport() before each of those special windows does achieves that. |
Version/Branch of Dear ImGui:
Version: 1.83
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: custom built from imgui_impl_Win32.cpp + imgui_impl_dx11.cpp
Operating System: Win10
My Issue/Question:
We want to prevent other windows from being able to merge with the main window. But we do want some known windows to always be merged in. There seems to be a flag to control this: ImGuiViewportFlags_CanHostOtherWindows. But this is always set on the main window, and there is no API for changing it.
Internally, we are now removing that flag from the call to AddUpdateViewport(NULL, IMGUI_VIEWPORT_DEFAULT_ID, ...) in imgui.cpp. We then set the flag manually on the main viewport when we add a window that we know we want merged with it, and re-clear it right after.
This does the trick, but it seems wrong to modify viewport flags directly. Ideally, there would be a setting to not have that flag always be set on the main window, and there would be another flag you can pass when creating a window to specifically allow merging with the main window even if the flag is not set on the main window.
The text was updated successfully, but these errors were encountered: