@ -12008,8 +12008,15 @@ static void ImGui::WindowSelectViewport(ImGuiWindow* window)
else if ( ( flags & ImGuiWindowFlags_ChildWindow ) | | ( flags & ImGuiWindowFlags_ChildMenu ) )
{
// Always inherit viewport from parent window
if ( window - > DockNode & & window - > DockNode - > HostWindow )
IM_ASSERT ( window - > DockNode - > HostWindow - > Viewport = = window - > ParentWindow - > Viewport ) ;
window - > Viewport = window - > ParentWindow - > Viewport ;
}
else if ( window - > DockNode & & window - > DockNode - > HostWindow )
{
// This covers the "always inherit viewport from parent window" case for when a window reattach to a node that was just created mid-frame
window - > Viewport = window - > DockNode - > HostWindow - > Viewport ;
}
else if ( flags & ImGuiWindowFlags_Tooltip )
{
window - > Viewport = g . MouseViewport ;
@ -12052,7 +12059,7 @@ static void ImGui::WindowSelectViewport(ImGuiWindow* window)
else
window - > ViewportAllowPlatformMonitorExtend = window - > Viewport - > PlatformMonitor ;
}
else if ( window - > Viewport & & window ! = window - > Viewport - > Window & & window - > Viewport - > Window & & ! ( flags & ImGuiWindowFlags_ChildWindow ) )
else if ( window - > Viewport & & window ! = window - > Viewport - > Window & & window - > Viewport - > Window & & ! ( flags & ImGuiWindowFlags_ChildWindow ) & & window - > DockNode = = NULL )
{
// When called from Begin() we don't have access to a proper version of the Hidden flag yet, so we replicate this code.
const bool will_be_visible = ( window - > DockIsActive & & ! window - > DockTabIsVisible ) ? false : true ;
@ -13445,6 +13452,7 @@ static void ImGui::DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window
if ( node - > HostWindow - > ViewportOwned & & node - > IsRootNode ( ) )
{
// Transfer viewport back to the remaining loose window
IMGUI_DEBUG_LOG_VIEWPORT ( " Node %08X transfer Viewport %08X=>%08X for Window '%s' \n " , node - > ID , node - > HostWindow - > Viewport - > ID , remaining_window - > ID , remaining_window - > Name ) ;
IM_ASSERT ( node - > HostWindow - > Viewport - > Window = = node - > HostWindow ) ;
node - > HostWindow - > Viewport - > Window = remaining_window ;
node - > HostWindow - > Viewport - > ID = remaining_window - > ID ;