mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 07:36:35 +00:00
Viewport: Fixed not clearing request flags in main viewport, which led some back-end (SDL) to break on resize as PlatformRequestResize would stay true forever and inhibit new sizes passed to AddUpdateViewport(). (#1542)
This commit is contained in:
parent
8dd83c5fe8
commit
d9fda22763
@ -3818,6 +3818,7 @@ void ImGui::EndFrame()
|
||||
IM_ASSERT(viewport->Window != NULL);
|
||||
g.PlatformIO.Viewports.push_back(viewport);
|
||||
}
|
||||
g.Viewports[0]->ClearRequestFlags(); // Clear main viewport flags because UpdatePlatformWindows() won't do it and may not even be called
|
||||
|
||||
// Sort the window list so that all child windows are after their parent
|
||||
// We cannot do that on FocusWindow() because childs may not exist yet
|
||||
@ -7760,7 +7761,7 @@ void ImGui::UpdatePlatformWindows()
|
||||
}
|
||||
|
||||
// Clear request flags
|
||||
viewport->PlatformRequestClose = viewport->PlatformRequestMove = viewport->PlatformRequestResize = false;
|
||||
viewport->ClearRequestFlags();
|
||||
}
|
||||
|
||||
// Update our implicit z-order knowledge of platform windows, which is used when the back-end cannot provide io.MouseHoveredViewport.
|
||||
@ -7865,7 +7866,7 @@ void ImGui::DestroyPlatformWindow(ImGuiViewportP* viewport)
|
||||
viewport->PlatformHandle = NULL;
|
||||
viewport->RendererUserData = viewport->PlatformHandle = NULL;
|
||||
viewport->PlatformWindowCreated = false;
|
||||
viewport->PlatformRequestClose = viewport->PlatformRequestMove = viewport->PlatformRequestResize = false;
|
||||
viewport->ClearRequestFlags();
|
||||
}
|
||||
|
||||
void ImGui::DestroyPlatformWindows()
|
||||
|
@ -672,10 +672,11 @@ struct ImGuiViewportP : public ImGuiViewport
|
||||
ImVec2 LastPlatformSize;
|
||||
ImVec2 LastRendererSize;
|
||||
|
||||
ImGuiViewportP() { Idx = -1; LastFrameActive = LastFrameOverlayDrawList = LastFrontMostStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; PlatformMonitor = -1; PlatformWindowCreated = PlatformWindowMinimized = false; Window = NULL; OverlayDrawList = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||
~ImGuiViewportP() { if (OverlayDrawList) IM_DELETE(OverlayDrawList); }
|
||||
ImRect GetRect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||
ImVec2 GetCenter() const{ return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
|
||||
ImGuiViewportP() { Idx = -1; LastFrameActive = LastFrameOverlayDrawList = LastFrontMostStampCount = -1; LastNameHash = 0; Alpha = LastAlpha = 1.0f; PlatformMonitor = -1; PlatformWindowCreated = PlatformWindowMinimized = false; Window = NULL; OverlayDrawList = NULL; LastPlatformPos = LastPlatformSize = LastRendererSize = ImVec2(FLT_MAX, FLT_MAX); }
|
||||
~ImGuiViewportP() { if (OverlayDrawList) IM_DELETE(OverlayDrawList); }
|
||||
ImRect GetRect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
|
||||
ImVec2 GetCenter() const { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
|
||||
void ClearRequestFlags() { PlatformRequestClose = PlatformRequestMove = PlatformRequestResize = false; }
|
||||
};
|
||||
|
||||
struct ImGuiNavMoveResult
|
||||
|
Loading…
Reference in New Issue
Block a user