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:
Axel Dörfler
2014-12-29 11:17:27 +01:00
parent f1bfd2dff3
commit d854d71111
+9
View File
@@ -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;