diff options
author | Chris Apers | 2005-12-11 19:46:51 +0000 |
---|---|---|
committer | Chris Apers | 2005-12-11 19:46:51 +0000 |
commit | 7c8b256dd12cefbb6ca593c0fccdb8f5f08a9a95 (patch) | |
tree | db8488e75dea9941f431c7bbe3f6b843166aa9fc /backends | |
parent | bf1fdc0db43491cd2542944ed5c436b2f740f7fd (diff) | |
download | scummvm-rg350-7c8b256dd12cefbb6ca593c0fccdb8f5f08a9a95.tar.gz scummvm-rg350-7c8b256dd12cefbb6ca593c0fccdb8f5f08a9a95.tar.bz2 scummvm-rg350-7c8b256dd12cefbb6ca593c0fccdb8f5f08a9a95.zip |
Auto-off on low battery only if the device is not plugged-in
Fixed compilation with standard ARM version
svn-id: r19779
Diffstat (limited to 'backends')
-rwxr-xr-x | backends/PalmOS/Src/base_event.cpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/backends/PalmOS/Src/base_event.cpp b/backends/PalmOS/Src/base_event.cpp index 84ec075f66..bdd12c5c6b 100755 --- a/backends/PalmOS/Src/base_event.cpp +++ b/backends/PalmOS/Src/base_event.cpp @@ -36,27 +36,30 @@ void OSystem_PalmBase::battery_handler() { // check battery level every 15secs if ((TimGetTicks() - _batCheckLast) > _batCheckTicks) { UInt16 voltage, warnThreshold, criticalThreshold; - voltage = SysBatteryInfoV20(false, &warnThreshold, &criticalThreshold, NULL, NULL, NULL); - - if (voltage <= warnThreshold) { - if (!_showBatLow) { - _showBatLow = true; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, true, 2); - displayMessageOnOSD("Battery low."); - } - } else { - if (_showBatLow) { - _showBatLow = false; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, false); + Boolean pluggedIn; + voltage = SysBatteryInfoV20(false, &warnThreshold, &criticalThreshold, NULL, NULL, &pluggedIn); + + if (!pluggedIn) { + if (voltage <= warnThreshold) { + if (!_showBatLow) { + _showBatLow = true; + draw_osd(kDrawBatLow, _screenDest.w - 18, -16, true, 2); + displayMessageOnOSD("Battery low."); + } + } else { + if (_showBatLow) { + _showBatLow = false; + draw_osd(kDrawBatLow, _screenDest.w - 18, -16, false); + } } - } - if (voltage <= criticalThreshold) { - ::EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrPowerOff; - event.data.keyDown.modifiers = commandKeyMask; - EvtAddEventToQueue(&event); + if (voltage <= criticalThreshold) { + ::EventType event; + event.eType = keyDownEvent; + event.data.keyDown.chr = vchrPowerOff; + event.data.keyDown.modifiers = commandKeyMask; + EvtAddEventToQueue(&event); + } } _batCheckLast = TimGetTicks(); @@ -74,7 +77,11 @@ bool OSystem_PalmBase::pollEvent(Event &event) { sound_handler(); for(;;) { +#if defined(COMPILE_OS5) && defined(PALMOS_ARM) + SysEventGet(&ev, evtNoWait); +#else EvtGetEvent(&ev, evtNoWait); +#endif // check for hardkey repeat for mouse emulation keyCurrentState = KeyCurrentState(); |