diff options
author | Paul Gilbert | 2011-05-16 20:12:16 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-05-16 20:17:02 +1000 |
commit | d610b40f7832f0502c796ccf44e192ac1e93b5dc (patch) | |
tree | f60f3e2ec937723bb9d3a7fe3279f0f7d3d984ac /engines | |
parent | 67f8a8b346d233d5e1e0aae67e20a3b2613eade3 (diff) | |
download | scummvm-rg350-d610b40f7832f0502c796ccf44e192ac1e93b5dc.tar.gz scummvm-rg350-d610b40f7832f0502c796ccf44e192ac1e93b5dc.tar.bz2 scummvm-rg350-d610b40f7832f0502c796ccf44e192ac1e93b5dc.zip |
TSAGE: Bugfixes for dialogs correctly handling ESCAPE and ENTER
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/graphics.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 5da00e8522..85dfc5d058 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -967,9 +967,10 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { // Event loop GfxButton *selectedButton = NULL; - while (!_vm->getEventManager()->shouldQuit()) { + bool breakFlag = false; + while (!_vm->getEventManager()->shouldQuit() && !breakFlag) { Event event; - while (_globals->_events.getEvent(event)) { + while (_globals->_events.getEvent(event) && !breakFlag) { // Adjust mouse positions to be relative within the dialog event.mousePos.x -= _gfxManager._bounds.left; event.mousePos.y -= _gfxManager._bounds.top; @@ -978,19 +979,23 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { if ((*i)->process(event)) selectedButton = static_cast<GfxButton *>(*i); } - } - if (selectedButton) - break; - else if (!event.handled) { - if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { - selectedButton = NULL; - break; - } else if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN)) { - selectedButton = defaultButton; + if (selectedButton) { + breakFlag = true; break; + } else if (!event.handled) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + selectedButton = NULL; + breakFlag = true; + break; + } else if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN)) { + selectedButton = defaultButton; + breakFlag = true; + break; + } } } + g_system->delayMillis(10); g_system->updateScreen(); } |