Viewport, Platform: Fixed a crash if the back-end set the PlatformRequestMove/PlatformRequestSize flags while viewports were disabled (it happened in the SDL back-end, and generally we want to tolerate it to make back-end implementation simpler). (#1542)

This commit is contained in:
omar 2018-05-23 18:01:50 +02:00
parent 1176460e44
commit ed84b2aaeb

View File

@ -3555,6 +3555,8 @@ static void ImGui::UpdateViewports()
continue; continue;
} }
if ((g.IO.ConfigFlags & ImGuiConfigFlags_ViewportsEnable))
{
// Apply Position and Size (from Platform Window to ImGui) if requested. // Apply Position and Size (from Platform Window to ImGui) if requested.
// We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities. // We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities.
if (viewport->PlatformRequestMove) if (viewport->PlatformRequestMove)
@ -3571,6 +3573,7 @@ static void ImGui::UpdateViewports()
// Update monitor (we'll use this info to clamp windows and save windows lost in a removed monitor) // Update monitor (we'll use this info to clamp windows and save windows lost in a removed monitor)
viewport->PlatformMonitor = FindPlatformMonitorForRect(viewport->GetRect()); viewport->PlatformMonitor = FindPlatformMonitorForRect(viewport->GetRect());
}
// Update DPI scale // Update DPI scale
float new_dpi_scale; float new_dpi_scale;