From 916dfab834fb127c82018f27212712c93e1f428d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 27 Oct 2026 18:03:27 +0100 Subject: [PATCH] UI: Round the corners of popups FillRoundRect falls back to a square FillRect for drawables it can't round, and a ViewGroup with round corners set rounds its background. Co-Authored-By: Claude Opus 5.5 --- Common/UI/Context.cpp | 3 ++- Common/UI/PopupScreens.cpp | 5 +++-- Common/UI/View.cpp | 2 +- Common/UI/ViewGroup.cpp | 6 +++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index b4deb5af30..118d1ac1bc 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -393,7 +393,8 @@ void UIContext::FillRoundRect(const UI::Drawable &drawable, const Bounds &bounds uidrawbuffer_->DrawRoundRect(bounds, radius, drawable.color, RoundRectStyle::Filled, corners); break; default: - // Not supported + // Not supported, draw it square. + FillRect(drawable, bounds); break; } } diff --git a/Common/UI/PopupScreens.cpp b/Common/UI/PopupScreens.cpp index 86d5d8acbc..1ef2abd816 100644 --- a/Common/UI/PopupScreens.cpp +++ b/Common/UI/PopupScreens.cpp @@ -233,8 +233,9 @@ void PopupScreen::CreateViews() { box_->Add(buttonRow); } - // The popup layout isn't compatible with round corners. - box_->ApplyRoundCorners(RoundCorners::None); + box_->SetRoundCorners(RoundCorners::All); + // Rounds the top of the header and the bottom of the last view, to match the box. + box_->ApplyRoundCorners(RoundCorners::All); } void MessagePopupScreen::CreatePopupContents(UI::ViewGroup *parent) { diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index fff44f9a19..2f4617fedc 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -734,7 +734,7 @@ void PopupHeader::Draw(UIContext &dc) { } // Header background - dc.FillRect(dc.GetTheme().popupTitleStyle.background, bounds_); + dc.FillRoundRect(dc.GetTheme().popupTitleStyle.background, bounds_, dc.GetTheme().choiceRoundRadius, roundCorners_); // Header title text dc.DrawText(text_, bounds_.x + tx, bounds_.centerY(), dc.GetTheme().popupTitleStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER); // Underline diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 9133e8db28..2440c417d2 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -187,7 +187,11 @@ void ViewGroup::Draw(UIContext &dc) { dc.PushScissor(bounds_); } - dc.FillRect(bg_, bounds_); + if (roundCorners_ != RoundCorners::None) { + dc.FillRoundRect(bg_, bounds_, dc.GetTheme().choiceRoundRadius, roundCorners_); + } else { + dc.FillRect(bg_, bounds_); + } for (View *view : views_) { if (view->GetVisibility() == V_VISIBLE) { // Check if bounds are in current scissor rectangle.