From d9ddab1a331e44a71943d176758f9924f0522c07 Mon Sep 17 00:00:00 2001 From: KamFretoZ <14798312+kamfretoz@users.noreply.github.com> Date: Fri, 23 Aug 2024 00:01:07 +0700 Subject: [PATCH] ImGuiFullscreen: Fix incorrect notification width Backport from: https://github.com/stenzek/duckstation/commit/e455a5e37172bbb3df5b141a74208cb3a267ad8e --- pcsx2/ImGui/ImGuiFullscreen.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pcsx2/ImGui/ImGuiFullscreen.cpp b/pcsx2/ImGui/ImGuiFullscreen.cpp index d3f92d26d9..ed566fa833 100644 --- a/pcsx2/ImGui/ImGuiFullscreen.cpp +++ b/pcsx2/ImGui/ImGuiFullscreen.cpp @@ -2679,16 +2679,17 @@ void ImGuiFullscreen::DrawNotifications(ImVec2& position, float spacing) continue; } - const ImVec2 title_size(text_font->CalcTextSizeA(title_font->FontSize, max_text_width, max_text_width, + const ImVec2 title_size(title_font->CalcTextSizeA(title_font->FontSize, max_text_width, max_text_width, notif.title.c_str(), notif.title.c_str() + notif.title.size())); const ImVec2 text_size(text_font->CalcTextSizeA(text_font->FontSize, max_text_width, max_text_width, notif.text.c_str(), notif.text.c_str() + notif.text.size())); - const float box_width = std::max( - (horizontal_padding * 2.0f) + badge_size + horizontal_spacing + std::max(title_size.x, text_size.x), min_width); + const float box_width = std::max((horizontal_padding * 2.0f) + badge_size + horizontal_spacing + + ImCeil(std::max(title_size.x, text_size.x)), + min_width); const float box_height = - std::max((vertical_padding * 2.0f) + title_size.y + vertical_spacing + text_size.y, min_height); + std::max((vertical_padding * 2.0f) + ImCeil(title_size.y) + vertical_spacing + ImCeil(text_size.y), min_height); u8 opacity; if (time_passed < NOTIFICATION_FADE_IN_TIME)