PowerStatus: hide obviously invalid probes.
* When we get bogus values back as the current battery state, there is little reason to present this to the user when we can detect it. * While it would be nice to solve the underlying bug, too (if there is one, this should make the new low battery notification feature a lot nicer in practice.
This commit is contained in:
@@ -351,6 +351,15 @@ PowerStatusView::Update(bool force)
|
||||
fTimeLeft = -1;
|
||||
}
|
||||
|
||||
if (fOnline && (fPercent <= 0 || fPercent > 100)) {
|
||||
// Just ignore this probe -- it obviously returned invalid values
|
||||
fPercent = previousPercent;
|
||||
fTimeLeft = previousTimeLeft;
|
||||
fOnline = wasOnline;
|
||||
fHasBattery = hadBattery;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fInDeskbar) {
|
||||
// make sure the tray icon is large enough
|
||||
float width = fShowStatusIcon ? kMinIconWidth + 2 : 0;
|
||||
|
||||
Reference in New Issue
Block a user