This commit is contained in:
Joran Bigalet 2025-03-20 10:41:56 +00:00 committed by GitHub
commit d14047623c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8798,9 +8798,11 @@ bool ImGui::BeginMainMenuBar()
ImGuiContext& g = *GImGui;
ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();
// Notify of viewport change so GetFrameHeight() can be accurate in case of DPI change
// Notify of viewport change and refresh font size so GetFrameHeight() can be accurate in case of DPI change
SetCurrentViewport(NULL, viewport);
float font_scale = (g.IO.ConfigFlags & ImGuiConfigFlags_DpiEnableScaleFonts) ? viewport->DpiScale : 1.0f;
g.FontSize = g.FontBaseSize * font_scale;
// For the main menu bar, which cannot be moved, we honor g.Style.DisplaySafeAreaPadding to ensure text can be visible on a TV set.
// FIXME: This could be generalized as an opt-in way to clamp window->DC.CursorStartPos to avoid SafeArea?
// FIXME: Consider removing support for safe area down the line... it's messy. Nowadays consoles have support for TV calibration in OS settings.