diff --git a/imgui.cpp b/imgui.cpp index aa858b9ad..48591b2a0 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5623,6 +5623,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // We don't default to the main viewport because. if (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 window->Viewport->ParentViewportId = g.IO.ConfigViewportsNoDefaultParent ? 0 : IMGUI_VIEWPORT_DEFAULT_ID; if (window->WindowClass.ViewportFlagsOverrideMask)