MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / UpdatePlatformWindows

Method UpdatePlatformWindows

Dependencies/ImGui/src/imgui.cpp:16465–16563  ·  view source on GitHub ↗

Called by user at the end of the main loop, after EndFrame() This will handle the creation/update of all OS windows via function defined in the ImGuiPlatformIO api.

Source from the content-addressed store, hash-verified

16463// Called by user at the end of the main loop, after EndFrame()
16464// This will handle the creation/update of all OS windows via function defined in the ImGuiPlatformIO api.
16465void ImGui::UpdatePlatformWindows()
16466{
16467 ImGuiContext& g = *GImGui;
16468 IM_ASSERT(g.FrameCountEnded == g.FrameCount && "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?");
16469 IM_ASSERT(g.FrameCountPlatformEnded < g.FrameCount);
16470 g.FrameCountPlatformEnded = g.FrameCount;
16471 if (!(g.ConfigFlagsCurrFrame & ImGuiConfigFlags_ViewportsEnable))
16472 return;
16473
16474 // Create/resize/destroy platform windows to match each active viewport.
16475 // Skip the main viewport (index 0), which is always fully handled by the application!
16476 for (int i = 1; i < g.Viewports.Size; i++)
16477 {
16478 ImGuiViewportP* viewport = g.Viewports[i];
16479
16480 // Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window
16481 // (the implicit/fallback Debug##Default window will be registering its viewport then be disabled, causing a dummy DestroyPlatformWindow to be made each frame)
16482 bool destroy_platform_window = false;
16483 destroy_platform_window |= (viewport->LastFrameActive < g.FrameCount - 1);
16484 destroy_platform_window |= (viewport->Window && !IsWindowActiveAndVisible(viewport->Window));
16485 if (destroy_platform_window)
16486 {
16487 DestroyPlatformWindow(viewport);
16488 continue;
16489 }
16490
16491 // New windows that appears directly in a new viewport won't always have a size on their first frame
16492 if (viewport->LastFrameActive < g.FrameCount || viewport->Size.x <= 0 || viewport->Size.y <= 0)
16493 continue;
16494
16495 // Create window
16496 const bool is_new_platform_window = (viewport->PlatformWindowCreated == false);
16497 if (is_new_platform_window)
16498 {
16499 IMGUI_DEBUG_LOG_VIEWPORT("[viewport] Create Platform Window %08X '%s'\n", viewport->ID, viewport->Window ? viewport->Window->Name : "n/a");
16500 g.PlatformIO.Platform_CreateWindow(viewport);
16501 if (g.PlatformIO.Renderer_CreateWindow != NULL)
16502 g.PlatformIO.Renderer_CreateWindow(viewport);
16503 g.PlatformWindowsCreatedCount++;
16504 viewport->LastNameHash = 0;
16505 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?)
16506 viewport->LastRendererSize = viewport->Size; // We don't need to call Renderer_SetWindowSize() as it is expected Renderer_CreateWindow() already did it.
16507 viewport->PlatformWindowCreated = true;
16508 }
16509
16510 // Apply Position and Size (from ImGui to Platform/Renderer backends)
16511 if ((viewport->LastPlatformPos.x != viewport->Pos.x || viewport->LastPlatformPos.y != viewport->Pos.y) && !viewport->PlatformRequestMove)
16512 g.PlatformIO.Platform_SetWindowPos(viewport, viewport->Pos);
16513 if ((viewport->LastPlatformSize.x != viewport->Size.x || viewport->LastPlatformSize.y != viewport->Size.y) && !viewport->PlatformRequestResize)
16514 g.PlatformIO.Platform_SetWindowSize(viewport, viewport->Size);
16515 if ((viewport->LastRendererSize.x != viewport->Size.x || viewport->LastRendererSize.y != viewport->Size.y) && g.PlatformIO.Renderer_SetWindowSize)
16516 g.PlatformIO.Renderer_SetWindowSize(viewport, viewport->Size);
16517 viewport->LastPlatformPos = viewport->Pos;
16518 viewport->LastPlatformSize = viewport->LastRendererSize = viewport->Size;
16519
16520 // Update title bar (if it changed)
16521 if (ImGuiWindow* window_for_title = GetWindowForTitleDisplay(viewport->Window))
16522 {

Callers

nothing calls this directly

Calls 5

IsWindowActiveAndVisibleFunction · 0.85
ImVec2Function · 0.85
GetWindowForTitleDisplayFunction · 0.85
ImHashStrFunction · 0.85
ClearRequestFlagsMethod · 0.80

Tested by

no test coverage detected