mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 14:56:35 +00:00
Viewports: fixed unnecessary creation of temporary viewports when multiple docked windows got reassigned to a new node (created mid-frame) which already has a HostWindow
This commit is contained in:
parent
6b1e094cfb
commit
9a49c1ddbd
@ -146,8 +146,10 @@ Docking+Viewports Branch:
|
||||
- IsWindowHovered: Fixed using ImGuiHoveredFlags_ChildWindows (without _RootWindow) from leaking the
|
||||
docking hierarchy. Added ImGuiHoveredFlags_DockHierarchy flag to consider docking hierarchy in the test.
|
||||
- Docking: fixed settings load issue when mouse wheeling. (#4310)
|
||||
- Drag and Drop: Fixed using BeginDragDropSource() or BeginDragDropTarget() inside a Begin() that
|
||||
returned false because the window is docked. (#4515)
|
||||
- Docking + Drag and Drop: Fixed using BeginDragDropSource() or BeginDragDropTarget() inside a Begin()
|
||||
that returned false because the window is docked. (#4515)
|
||||
- Viewports: Viewports: fixed unnecessary creation of temporary viewports when multiple docked windows
|
||||
got reassigned to a new node (created mid-frame) which already has a HostWindow.
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
10
imgui.cpp
10
imgui.cpp
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user