aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/PalmOS/Src/palm.cpp17
-rw-r--r--gui/newgui.cpp14
2 files changed, 21 insertions, 10 deletions
diff --git a/backends/PalmOS/Src/palm.cpp b/backends/PalmOS/Src/palm.cpp
index 5ee2319f82..529b720897 100644
--- a/backends/PalmOS/Src/palm.cpp
+++ b/backends/PalmOS/Src/palm.cpp
@@ -621,9 +621,11 @@ bool OSystem_PALMOS::poll_event(Event *event) {
UInt32 current_msecs;
UInt32 keyCurrentState;
Coord x, y;
-
- if(_quit)
+
+ if(_quit) {
+ exit(0); // resend an exit event
return false;
+ }
current_msecs = get_msecs();
//thread handler
@@ -642,6 +644,9 @@ bool OSystem_PALMOS::poll_event(Event *event) {
_timer.next_expiry = current_msecs + _timer.duration;
}
+ if (_selfQuit)
+ quit();
+
for(;;) {
EvtGetEvent(&ev, evtNoWait);
@@ -677,10 +682,8 @@ bool OSystem_PALMOS::poll_event(Event *event) {
case vchrCalc:
if (_lastKeyPressed == vchrCalc)
- if ((get_msecs() - _exit_delay) <= (EXITDELAY)) {
+ if ((get_msecs() - _exit_delay) <= (EXITDELAY))
_selfQuit = true;
- quit();
- }
_exit_delay = get_msecs();
_lastKeyPressed = vchrCalc;
@@ -735,7 +738,6 @@ bool OSystem_PALMOS::poll_event(Event *event) {
case vchrHardCradle:
case vchrHardCradle2:
_selfQuit = true;
- quit();
}
}
// check for hardkey repeat
@@ -779,7 +781,6 @@ bool OSystem_PALMOS::poll_event(Event *event) {
if (ev.data.keyDown.chr == 'z' && b == KBD_CTRL) {
_selfQuit = true;
- quit();
} else if (ev.data.keyDown.chr == 'n' && b == KBD_CTRL) {
UInt8 *scr = _screenP + _screenWidth * (_screenHeight + 2);
@@ -1144,7 +1145,7 @@ void OSystem_PALMOS::play_cdrom(int track, int num_loops, int start_frame, int e
// stop current play if any
MsaStop(_msaRefNum, true);
- // retreive track info
+ // retreive track infos
e = MsaGetTrackInfo(_msaRefNum, _msaTrack, 0, msa_LANG_CODE_ASCII, &trackH);
// if (e) doErr(e, "MsaGetTrackInfo");
// track exists
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index dc2a7fae17..90df0c978b 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -23,6 +23,9 @@
#include "newgui.h"
#include "dialog.h"
+#ifdef __PALM_OS__
+# include "palm.h"
+#endif
#ifdef _MSC_VER
# pragma warning( disable : 4068 ) // unknown pragma
@@ -118,7 +121,15 @@ void NewGui::runLoop() {
}
while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) {
-
+#ifdef __PALM_OS__
+ // There is no exit(.) function under PalmOS, to exit an app
+ // we need to send an 'exit' event to the event handler
+ // and then the system return to the launcher. But this event
+ // is not handled by the following loop and so we need to force exit.
+ // In other systems like Windows ScummVM exit immediatly and so this doesn't appear.
+ if (((OSystem_PALMOS *)_system)->_quit)
+ return;
+#endif
activeDialog->handleTickle();
if (_needRedraw) {
@@ -528,4 +539,3 @@ void NewGui_initGlobals() {
}
void NewGui_releaseGlobals(){ GRELEASEPTR(GBVARS_GUIFONT_INDEX, GBVARS_SCUMM) }
#endif
-