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 <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Máximo Castañeda
2026-07-16 19:42:52 +00:00
committed by waddlesplash
parent 2d2a1db5fc
commit 0d2f93c47b
2 changed files with 8 additions and 23 deletions
+7 -21
View File
@@ -105,7 +105,7 @@ BCountView::TrySpinningBarberPole()
// After this the text needs no updating since only the pole changes. // After this the text needs no updating since only the pole changes.
if (fStartSpinningAfter) { if (fStartSpinningAfter) {
fStartSpinningAfter = 0; fStartSpinningAfter = 0;
Invalidate(TextAndBarberPoleRect()); Invalidate();
} else } else
Invalidate(BarberPoleInnerRect()); Invalidate(BarberPoleInnerRect());
} }
@@ -163,25 +163,15 @@ BCountView::BarberPoleOuterRect() const
BRect BRect
BCountView::TextInvalRect() const BCountView::TextRect() 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
{ {
BRect result = Bounds(); BRect result = Bounds();
result.InsetBy(be_control_look->ComposeSpacing(B_USE_SMALL_SPACING) / 2, result.InsetBy(be_control_look->ComposeSpacing(B_USE_SMALL_SPACING) / 2,
floorf(result.Height() * 0.25f)); floorf(result.Height() * 0.25f));
if (fShowingBarberPole)
result.right -= 10;
return result; return result;
} }
@@ -201,12 +191,8 @@ BCountView::CheckCount()
invalidate = true; invalidate = true;
} }
// invalidate the count text area if necessary
if (invalidate) if (invalidate)
Invalidate(TextInvalRect()); Invalidate();
// invalidate barber pole area if necessary
TrySpinningBarberPole();
} }
@@ -263,7 +249,7 @@ BCountView::Draw(BRect updateRect)
} }
} }
BRect textRect(TextInvalRect()); BRect textRect(TextRect());
// leave room for pop up indicator // leave room for pop up indicator
float popUpWidth = be_control_look->DefaultItemSpacing(); float popUpWidth = be_control_look->DefaultItemSpacing();
+1 -2
View File
@@ -76,8 +76,7 @@ public:
private: private:
BRect BarberPoleInnerRect() const; BRect BarberPoleInnerRect() const;
BRect BarberPoleOuterRect() const; BRect BarberPoleOuterRect() const;
BRect TextInvalRect() const; BRect TextRect() const;
BRect TextAndBarberPoleRect() const;
void TrySpinningBarberPole(); void TrySpinningBarberPole();
int32 fLastCount; int32 fLastCount;