viewport->LastPlatformPos=viewport->LastPlatformSize=ImVec2(FLT_MAX,FLT_MAX);// By clearing those we'll enforce a call to Platform_SetWindowPos/Platform_SetWindowSize before Platform_ShowWindow
viewport->LastRendererSize=viewport->Size;
viewport->LastPlatformPos=viewport->LastPlatformSize=ImVec2(FLT_MAX,FLT_MAX);// By clearing those we'll enforce a call to Platform_SetWindowPos/Size below, before Platform_ShowWindow (FIXME: Is that necessary?)
viewport->LastRendererSize=viewport->Size;// We don't need to call Renderer_SetWindowSize() as it is expected Renderer_CreateWindow() already did it.
// Show window. On startup ensure platform window don't get focus
if(is_new_window)
if(is_new_platform_window)
{
if(g.FrameCount<3)// Give a few frames for the application to stabilize (nested contents may lead to viewport being created a few frames late)
// On startup ensure new platform window don't steal focus (give it a few frames, as nested contents may lead to viewport being created a few frames late)
// Even without focus, we assume the window becomes front-most. This is used by our platform z-order heuristic when io.MouseHoveredViewport is not available.
// This is a default/basic function for performing the rendering/swap of multiple Platform Windows.
// Custom renderers may prefer to not call this function at all, and instead iterate the publicly exposed platform data and handle rendering/sync themselves.
// The Render/Swap functions stored in ImGuiPlatformIO are merely here to allow for this helper to exist, but you can do it yourself:
@ -7798,37 +7830,6 @@ static int ImGui::FindPlatformMonitorForRect(const ImRect& rect)
returnbest_monitor_n;
}
// This is a default/basic function for performing the rendering/swap of multiple platform windows.
// Custom renderers may prefer to not call this function at all, and instead iterate the publicly exposed platform data and handle rendering/sync themselves.
// The Render/Swap functions stored in ImGuiPlatformIO are merely here to allow for this helper to exist, but you can do it yourself:
float(*Platform_GetWindowDpiScale)(ImGuiViewport*vp);// (Optional) [BETA] (FIXME-DPI) DPI handling: Return DPI scale for this viewport. 1.0f = 96 DPI.
void(*Platform_OnChangedViewport)(ImGuiViewport*vp);// (Optional) [BETA] (FIXME-DPI) DPI handling: Called during Begin() every time the viewport we are outputting into changes, so back-end has a chance to swap fonts to adjust style.
@ -2213,8 +2214,8 @@ enum ImGuiViewportFlags_
// The viewports created and managed by imgui. The role of the platform back-end is to create the platform/OS windows corresponding to each viewport.
structImGuiViewport
{
ImGuiIDID;
ImGuiViewportFlagsFlags;
ImGuiIDID;// Unique identifier for the viewport
ImGuiViewportFlagsFlags;// See ImGuiViewportFlags_
ImVec2Pos;// Position of viewport both in imgui space and in OS desktop/native space