[PowerStatus] Fixes some drawing glitches

* Fixes the position of the lightning over the battery
* Fixes the selection in the info Window (Why is the selected color hardcoded?)
* Fixes #13784
This commit is contained in:
Janus
2017-11-19 01:05:38 +01:00
parent aafb7e69a9
commit 24c9b9df7a
2 changed files with 7 additions and 5 deletions
+5 -4
View File
@@ -279,11 +279,12 @@ ExtPowerStatusView::ExtPowerStatusView(PowerStatusDriverInterface* interface,
void
ExtPowerStatusView::Draw(BRect updateRect)
{
if (fSelected)
if (fSelected) {
rgb_color lowColor = LowColor();
SetLowColor(102, 152, 203);
else
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
FillRect(updateRect, B_SOLID_LOW);
SetLowColor(lowColor);
}
PowerStatusView::Draw(updateRect);
}
+2 -1
View File
@@ -163,6 +163,7 @@ PowerStatusView::MessageReceived(BMessage *message)
void
PowerStatusView::_DrawBattery(BRect rect)
{
BRect lightningRect = rect;
float quarter = floorf((rect.Height() + 1) / 4);
rect.top += quarter;
rect.bottom -= quarter;
@@ -246,7 +247,7 @@ PowerStatusView::_DrawBattery(BRect rect)
// When charging, draw a lightning symbol over the battery.
SetHighColor(255, 255, 0, 180);
SetDrawingMode(B_OP_ALPHA);
SetScale(std::min(Bounds().Width(), Bounds().Height()) / 16);
SetScale(std::min(lightningRect.Width(), lightningRect.Height()) / 16);
static const BPoint points[] = {
BPoint(3, 14),