Viewports: trying to treat GetMainViewport() as const. Reducing unnecessary casts of ImGuiViewportP*

Metrics: readded root Drawlists node in metrics to match master.
The (void*) casts are implying const-casst but currently left GetMainViewport() as returning non-const.
This commit is contained in:
ocornut
2021-02-09 12:02:55 +01:00
parent 862bfc53d3
commit 1a3af8cb4c
5 changed files with 47 additions and 22 deletions

View File

@ -6575,7 +6575,7 @@ void ImGui::EndMenuBar()
bool ImGui::BeginMainMenuBar()
{
ImGuiContext& g = *GImGui;
ImGuiViewportP* viewport = (ImGuiViewportP*)GetMainViewport();
ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();
ImGuiWindow* menu_bar_window = FindWindowByName("##MainMenuBar");
// For the main menu bar, which cannot be moved, we honor g.Style.DisplaySafeAreaPadding to ensure text can be visible on a TV set.