mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 22:26:34 +00:00
Viewport: Fix viewport regression with protruding child window creating their own viewport. (fixes cae4d02
, 760c1d95
) (#1542)
This commit is contained in:
parent
d8ab2c1ac9
commit
379733aba1
13
imgui.cpp
13
imgui.cpp
@ -7498,6 +7498,10 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
||||
window->Viewport = AddUpdateViewport(window, window->ID, window->Pos, window->Size, ImGuiViewportFlags_None);
|
||||
}
|
||||
|
||||
// Fallback to default viewport
|
||||
if (window->Viewport == NULL)
|
||||
window->Viewport = main_viewport;
|
||||
|
||||
// Mark window as allowed to protrude outside of its viewport and into the current monitor
|
||||
// We need to take account of the possibility that mouse may become invalid.
|
||||
if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))
|
||||
@ -7507,15 +7511,8 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
||||
bool mouse_valid = IsMousePosValid(&mouse_ref);
|
||||
if ((window->Appearing || (flags & ImGuiWindowFlags_Tooltip)) && (!use_mouse_ref || mouse_valid))
|
||||
window->ViewportAllowPlatformMonitorExtend = FindPlatformMonitorForPos((use_mouse_ref && mouse_valid) ? mouse_ref : NavCalcPreferredRefPos());
|
||||
else
|
||||
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
||||
}
|
||||
|
||||
// Fallback to default viewport
|
||||
if (window->Viewport == NULL)
|
||||
window->Viewport = main_viewport;
|
||||
|
||||
if (window->ViewportAllowPlatformMonitorExtend < 0)
|
||||
if (window->ViewportAllowPlatformMonitorExtend < 0 && (flags & ImGuiWindowFlags_ChildWindow) == 0)
|
||||
window->ViewportAllowPlatformMonitorExtend = window->Viewport->PlatformMonitor;
|
||||
|
||||
// Update flags
|
||||
|
Loading…
Reference in New Issue
Block a user