mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Docking: Fixed dock node with single window accidental stealing of non-owned host viewport (leading to general havoc).
This commit is contained in:
parent
35d1fb7b34
commit
46dff42239
@ -7381,6 +7381,7 @@ static void ImGui::UpdateViewports()
|
|||||||
// Update main viewport with current platform position and size
|
// Update main viewport with current platform position and size
|
||||||
ImGuiViewportP* main_viewport = g.Viewports[0];
|
ImGuiViewportP* main_viewport = g.Viewports[0];
|
||||||
IM_ASSERT(main_viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID);
|
IM_ASSERT(main_viewport->ID == IMGUI_VIEWPORT_DEFAULT_ID);
|
||||||
|
IM_ASSERT(main_viewport->Window == NULL);
|
||||||
ImVec2 main_viewport_platform_pos = ImVec2(0.0f, 0.0f);
|
ImVec2 main_viewport_platform_pos = ImVec2(0.0f, 0.0f);
|
||||||
if ((g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
if ((g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
|
||||||
main_viewport_platform_pos = g.PlatformIO.Platform_GetWindowPos(main_viewport);
|
main_viewport_platform_pos = g.PlatformIO.Platform_GetWindowPos(main_viewport);
|
||||||
@ -10524,7 +10525,11 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
|
|||||||
{
|
{
|
||||||
single_window->Viewport = node->HostWindow->Viewport;
|
single_window->Viewport = node->HostWindow->Viewport;
|
||||||
single_window->ViewportId = node->HostWindow->ViewportId;
|
single_window->ViewportId = node->HostWindow->ViewportId;
|
||||||
|
if (node->HostWindow->ViewportOwned)
|
||||||
|
{
|
||||||
single_window->Viewport->Window = single_window;
|
single_window->Viewport->Window = single_window;
|
||||||
|
single_window->ViewportOwned = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DockNodeHideHostWindow(node);
|
DockNodeHideHostWindow(node);
|
||||||
|
@ -657,7 +657,7 @@ struct ImGuiViewportP : public ImGuiViewport
|
|||||||
float Alpha; // Window opacity (when dragging dockable windows/viewports we make them transparent)
|
float Alpha; // Window opacity (when dragging dockable windows/viewports we make them transparent)
|
||||||
float LastAlpha;
|
float LastAlpha;
|
||||||
int PlatformMonitor;
|
int PlatformMonitor;
|
||||||
ImGuiWindow* Window;
|
ImGuiWindow* Window; // Set when the viewport is owned by a window
|
||||||
ImDrawList* OverlayDrawList; // For convenience, a draw list we can render to that's always rendered last (we use it to draw software mouse cursor when io.MouseDrawCursor is set)
|
ImDrawList* OverlayDrawList; // For convenience, a draw list we can render to that's always rendered last (we use it to draw software mouse cursor when io.MouseDrawCursor is set)
|
||||||
ImDrawData DrawDataP;
|
ImDrawData DrawDataP;
|
||||||
ImDrawDataBuilder DrawDataBuilder;
|
ImDrawDataBuilder DrawDataBuilder;
|
||||||
|
Loading…
Reference in New Issue
Block a user