Ticket #6952: powerstatus_r1.patch
File powerstatus_r1.patch, 1.3 KB (added by , 13 years ago) |
---|
-
src/apps/powerstatus/PowerStatusView.cpp
177 177 rect.left - 1, floorf(rect.bottom - rect.Height() / 4))); 178 178 179 179 int32 percent = fPercent; 180 if (percent > 100 || percent < 0 || !fHasBattery)180 if (percent > 100) 181 181 percent = 100; 182 else if (percent < 0 || !fHasBattery) 183 percent = 0; 182 184 183 185 if (percent > 0) { 184 186 rect.InsetBy(gap, gap); … … 332 334 333 335 _GetBatteryInfo(&fBatteryInfo, fBatteryID); 334 336 335 if (fBatteryInfo.full_capacity != 0) 337 fHasBattery = (fBatteryInfo.state & BATTERY_CRITICAL_STATE) == 0; 338 339 if (fBatteryInfo.full_capacity > 0 && fHasBattery) { 336 340 fPercent = (100 * fBatteryInfo.capacity) / fBatteryInfo.full_capacity; 337 338 fTimeLeft = fBatteryInfo.time_left; 339 if ((fBatteryInfo.state & BATTERY_CHARGING) != 0) 340 fOnline = true; 341 else 341 fOnline = (fBatteryInfo.state & BATTERY_CHARGING) != 0; 342 fTimeLeft = fBatteryInfo.time_left; 343 } else { 344 fPercent = 0; 342 345 fOnline = false; 346 fTimeLeft = false; 347 } 343 348 344 // TODO: if critical really means that, its name should be changed...345 fHasBattery = (fBatteryInfo.state & BATTERY_CRITICAL_STATE) == 0346 && fPercent >= 0;347 349 348 350 if (fInDeskbar) { 349 351 // make sure the tray icon is large enough