1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-16 20:07:18 +01:00

Viewport: Popups and Tooltips viewports are correctly parented to the parent window's viewport. (#2409, #1542)

This commit is contained in:
omar 2019-03-11 16:51:46 +01:00
parent f7db4fad31
commit 3ead9820f7

View File

@ -5623,6 +5623,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// We don't default to the main viewport because. // We don't default to the main viewport because.
if (window->WindowClass.ParentViewportId) if (window->WindowClass.ParentViewportId)
window->Viewport->ParentViewportId = window->WindowClass.ParentViewportId; window->Viewport->ParentViewportId = window->WindowClass.ParentViewportId;
else if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && parent_window_in_stack)
window->Viewport->ParentViewportId = parent_window_in_stack->Viewport->ID;
else else
window->Viewport->ParentViewportId = g.IO.ConfigViewportsNoDefaultParent ? 0 : IMGUI_VIEWPORT_DEFAULT_ID; window->Viewport->ParentViewportId = g.IO.ConfigViewportsNoDefaultParent ? 0 : IMGUI_VIEWPORT_DEFAULT_ID;
if (window->WindowClass.ViewportFlagsOverrideMask) if (window->WindowClass.ViewportFlagsOverrideMask)