mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[STOBJECT] Do not report the remaining battery capacity if it is unknown
Support for system batteries in ReactOS is really minimal to the point of non-existing. We are detecting the presence of any upcoming battery but since there's lacking in critical code that deals with communication between PO and the battery class driver as the battery systray icon uses GetSystemPowerStatus to gather battery info which in turn inquires the power manager via NtPowerInformation(SystemBatteryState), we have to report to the user that the remaining capacity is unknown rather than returning a pseudo capacity value. Technically this so called "pesudo" value is just a construct denoted as BATTERY_PERCENTAGE_UNKNOWN. Not reporting the actual remaining capacity makes sense, as there could be a scenario where the battery may not properly report its real datum, therefore it's best to be honest to the user what's really going on. CORE-19452 CORE-18969
This commit is contained in:
parent
fae7c0f70e
commit
07a76b3dec
1 changed files with 6 additions and 0 deletions
|
@ -90,6 +90,12 @@ static HICON DynamicLoadIcon(HINSTANCE hinst)
|
|||
}
|
||||
|
||||
if (((PowerStatus.BatteryFlag & BATTERY_FLAG_NO_BATTERY) == 0) &&
|
||||
(PowerStatus.BatteryLifePercent == BATTERY_PERCENTAGE_UNKNOWN))
|
||||
{
|
||||
hBatIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_BATTCAP_ERR));
|
||||
g_strTooltip.LoadStringW(IDS_PWR_UNKNOWN_REMAINING);
|
||||
}
|
||||
else if (((PowerStatus.BatteryFlag & BATTERY_FLAG_NO_BATTERY) == 0) &&
|
||||
((PowerStatus.BatteryFlag & BATTERY_FLAG_CHARGING) == BATTERY_FLAG_CHARGING))
|
||||
{
|
||||
index = Quantize(PowerStatus.BatteryLifePercent);
|
||||
|
|
Loading…
Reference in a new issue