From 0d2f93c47b32a9d3c3672514893284782521a12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Casta=C3=B1eda?= Date: Mon, 13 Jul 2026 18:06:46 +0200 Subject: [PATCH] Tracker/CountView: correct invalidation of text area Strings used for other languages may have descenders, and for some fonts and characters (like italics) the edges may go out of the escapement. On top of that, `TextAndBarberPoleRect()` doesn't include the whole barber pole area. Fixes: #18058, possibly #17901 Change-Id: I940676eaff9485969dac4f1d56bd6243e3d19581 Reviewed-on: https://review.haiku-os.org/c/haiku/+/11257 Tested-by: Commit checker robot Haiku-Format: Haiku-format Bot Reviewed-by: waddlesplash --- src/kits/tracker/CountView.cpp | 28 +++++++--------------------- src/kits/tracker/CountView.h | 3 +-- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/kits/tracker/CountView.cpp b/src/kits/tracker/CountView.cpp index b83e623ffb..24ef826556 100644 --- a/src/kits/tracker/CountView.cpp +++ b/src/kits/tracker/CountView.cpp @@ -105,7 +105,7 @@ BCountView::TrySpinningBarberPole() // After this the text needs no updating since only the pole changes. if (fStartSpinningAfter) { fStartSpinningAfter = 0; - Invalidate(TextAndBarberPoleRect()); + Invalidate(); } else Invalidate(BarberPoleInnerRect()); } @@ -163,25 +163,15 @@ BCountView::BarberPoleOuterRect() const BRect -BCountView::TextInvalRect() const -{ - BRect result = TextAndBarberPoleRect(); - - // if the barber pole is not present, use its space for text - if (fShowingBarberPole) - result.right -= 10; - - return result; -} - - -BRect -BCountView::TextAndBarberPoleRect() const +BCountView::TextRect() const { BRect result = Bounds(); result.InsetBy(be_control_look->ComposeSpacing(B_USE_SMALL_SPACING) / 2, floorf(result.Height() * 0.25f)); + if (fShowingBarberPole) + result.right -= 10; + return result; } @@ -201,12 +191,8 @@ BCountView::CheckCount() invalidate = true; } - // invalidate the count text area if necessary if (invalidate) - Invalidate(TextInvalRect()); - - // invalidate barber pole area if necessary - TrySpinningBarberPole(); + Invalidate(); } @@ -263,7 +249,7 @@ BCountView::Draw(BRect updateRect) } } - BRect textRect(TextInvalRect()); + BRect textRect(TextRect()); // leave room for pop up indicator float popUpWidth = be_control_look->DefaultItemSpacing(); diff --git a/src/kits/tracker/CountView.h b/src/kits/tracker/CountView.h index cb0c025ad6..b937ec84b9 100644 --- a/src/kits/tracker/CountView.h +++ b/src/kits/tracker/CountView.h @@ -76,8 +76,7 @@ public: private: BRect BarberPoleInnerRect() const; BRect BarberPoleOuterRect() const; - BRect TextInvalRect() const; - BRect TextAndBarberPoleRect() const; + BRect TextRect() const; void TrySpinningBarberPole(); int32 fLastCount;