diff --git a/src/core/achievements.cpp b/src/core/achievements.cpp index 04109778c..2d538c88e 100644 --- a/src/core/achievements.cpp +++ b/src/core/achievements.cpp @@ -2288,7 +2288,8 @@ void Achievements::DrawGameOverlays() const auto lock = GetLock(); - const float margin = std::max(ImGuiManager::GetScreenMargin(), LayoutScale(10.0f)); + const float margin = + std::max(ImCeil(ImGuiManager::GetScreenMargin() * ImGuiManager::GetGlobalScale()), LayoutScale(10.0f)); const float spacing = LayoutScale(10.0f); const float padding = LayoutScale(10.0f); const ImVec2 image_size = diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index ad53493ae..48fb1553b 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -449,6 +449,8 @@ void ImGuiFullscreen::UploadAsyncTextures() bool ImGuiFullscreen::UpdateLayoutScale() { +#ifndef __ANDROID__ + static constexpr float LAYOUT_RATIO = LAYOUT_SCREEN_WIDTH / LAYOUT_SCREEN_HEIGHT; const ImGuiIO& io = ImGui::GetIO(); @@ -474,7 +476,19 @@ bool ImGuiFullscreen::UpdateLayoutScale() UIStyle.RcpLayoutScale = 1.0f / UIStyle.LayoutScale; - return UIStyle.LayoutScale != old_scale; + return (UIStyle.LayoutScale != old_scale); + +#else + + // On Android, treat a rotated display as always being in landscape mode for FSUI scaling. + // Makes achievement popups readable regardless of the device's orientation, and avoids layout changes. + const ImGuiIO& io = ImGui::GetIO(); + const float old_scale = UIStyle.LayoutScale; + UIStyle.LayoutScale = std::max(io.DisplaySize.x, io.DisplaySize.y) / LAYOUT_SCREEN_WIDTH; + UIStyle.RcpLayoutScale = 1.0f / UIStyle.LayoutScale; + return (UIStyle.LayoutScale != old_scale); + +#endif } ImRect ImGuiFullscreen::CenterImage(const ImVec2& fit_size, const ImVec2& image_size)