aboutsummaryrefslogtreecommitdiff
path: root/backends/events/default/default-events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/events/default/default-events.cpp')
-rw-r--r--backends/events/default/default-events.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 9ab7ab620c..feed4b0c62 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -97,7 +97,8 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
_buttonState(0),
_modifierState(0),
_shouldQuit(false),
- _shouldRTL(false) {
+ _shouldRTL(false),
+ _confirmExitDialogActive(false) {
assert(_boss);
@@ -378,15 +379,14 @@ void DefaultEventManager::processMillis(uint32 &millis) {
bool DefaultEventManager::pollEvent(Common::Event &event) {
uint32 time = _boss->getMillis();
- bool result = false;
-
- // poll for pushed events
- if (!_artificialEventQueue.empty()) {
- event = _artificialEventQueue.pop();
+ bool result;
+
+ if (!artificialEventQueue.empty()) {
+ event = artificialEventQueue.pop();
result = true;
} else {
- // poll for event from backend
result = _boss->pollEvent(event);
+
#ifdef ENABLE_KEYMAPPER
if (result) {
// send key press events to keymapper
@@ -441,7 +441,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
if (g_engine && !g_engine->isPaused()) {
Common::Event menuEvent;
menuEvent.type = Common::EVENT_MAINMENU;
-
+
// FIXME: GSoC RTL branch passes the F6 key event to the
// engine, and also enqueues a EVENT_MAINMENU. For now,
// we just drop the key event and return an EVENT_MAINMENU
@@ -450,7 +450,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
//
// However, this has other consequences, possibly negative ones.
// Like, what happens with key repeat for the trigger key?
-
+
//pushEvent(menuEvent);
event = menuEvent;
@@ -539,17 +539,31 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
break;
case Common::EVENT_RTL:
- _shouldRTL = true;
+ if (ConfMan.getBool("confirm_exit")) {
+ if (g_engine)
+ g_engine->pauseEngine(true);
+ GUI::MessageDialog alert("Do you really want to return to the Launcher?", "Launcher", "Cancel");
+ result = _shouldRTL = (alert.runModal() == GUI::kMessageOK);
+ if (g_engine)
+ g_engine->pauseEngine(false);
+ } else
+ _shouldRTL = true;
break;
case Common::EVENT_QUIT:
if (ConfMan.getBool("confirm_exit")) {
+ if (_confirmExitDialogActive) {
+ result = false;
+ break;
+ }
+ _confirmExitDialogActive = true;
if (g_engine)
g_engine->pauseEngine(true);
- GUI::MessageDialog alert("Do you really want to quit?", "Yes", "No");
+ GUI::MessageDialog alert("Do you really want to quit?", "Quit", "Cancel");
result = _shouldQuit = (alert.runModal() == GUI::kMessageOK);
if (g_engine)
g_engine->pauseEngine(false);
+ _confirmExitDialogActive = false;
} else
_shouldQuit = true;
@@ -581,8 +595,8 @@ void DefaultEventManager::pushEvent(const Common::Event &event) {
if (event.type == Common::EVENT_QUIT) {
if (!_shouldQuit)
artificialEventQueue.push(event);
- } else
- artificialEventQueue.push(event);
+ } else
+ artificialEventQueue.push(event);
}
#endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)