PowerStatus: Draw battery icon even if there isn't enough space

This allows for drawing the battery icon in Deskbar at 8pt font.

Change-Id: Ibd8f151fe5a16da5f812083a3d5457991b3c49a8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2300
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
John Scipione 2020-03-01 14:52:32 -05:00 committed by waddlesplash
parent 9b33a309da
commit 98a8bc858e

View File

@ -58,9 +58,6 @@ const uint32 kMsgToggleTime = 'tgtm';
const uint32 kMsgToggleStatusIcon = 'tgsi';
const uint32 kMsgToggleExtInfo = 'texi';
const uint32 kMinIconWidth = 16;
const uint32 kMinIconHeight = 16;
const int32 kLowBatteryPercentage = 15;
const int32 kNoteBatteryPercentage = 30;
@ -319,18 +316,10 @@ PowerStatusView::DrawTo(BView* view, BRect rect)
if (fShowStatusIcon) {
iconRect = rect;
if (showLabel) {
if (inside == false)
if (showLabel && inside == false)
iconRect.right -= textWidth + 2;
}
if (iconRect.Width() + 1 >= kMinIconWidth
&& iconRect.Height() + 1 >= kMinIconHeight) {
_DrawBattery(view, iconRect);
} else {
// there is not enough space for the icon
iconRect.Set(0, 0, -1, -1);
}
}
if (showLabel) {