aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTarek Soliman2011-10-31 22:38:05 -0500
committerTarek Soliman2011-10-31 22:59:55 -0500
commit6523454db5c115bcaf1bc24380a444dfbdab43e3 (patch)
tree1a27d9117b55f1837377a221d81a873cbb58a65d
parent843f19788b7d83074f811f786663186fc43e64e1 (diff)
downloadscummvm-rg350-6523454db5c115bcaf1bc24380a444dfbdab43e3.tar.gz
scummvm-rg350-6523454db5c115bcaf1bc24380a444dfbdab43e3.tar.bz2
scummvm-rg350-6523454db5c115bcaf1bc24380a444dfbdab43e3.zip
KEYMAPPER: Put the gui keymap pushing/popping back in GuiManager::runLoop
This because theoretically the GUI could be run without a dialog. This also fixes the situations where the GUI keymap gets popped more times than pushed. Thanks sev
-rw-r--r--gui/dialog.cpp8
-rw-r--r--gui/gui-manager.cpp13
2 files changed, 13 insertions, 8 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 9f18baec9e..0522b40b46 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -86,10 +86,6 @@ void Dialog::open() {
}
setFocusWidget(w);
-#ifdef ENABLE_KEYMAPPER
- g_gui.initKeymap();
- g_gui.pushKeymap();
-#endif
}
void Dialog::close() {
@@ -101,10 +97,6 @@ void Dialog::close() {
}
releaseFocus();
g_gui.closeTopDialog();
-#ifdef ENABLE_KEYMAPPER
- g_gui.popKeymap();
-#endif
-
}
void Dialog::reflowLayout() {
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 849044286d..98840e6daf 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -286,6 +286,15 @@ void GuiManager::runLoop() {
uint32 lastRedraw = 0;
const uint32 waitTime = 1000 / 45;
+#ifdef ENABLE_KEYMAPPER
+ // Due to circular reference with event manager and GUI
+ // we cannot init keymap on the GUI creation. Thus, let's
+ // try to do it on every launch, checking whether the
+ // map is already existing
+ initKeymap();
+ pushKeymap();
+#endif
+
bool tooltipCheck = false;
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
@@ -397,6 +406,10 @@ void GuiManager::runLoop() {
_system->delayMillis(10);
}
+#ifdef ENABLE_KEYMAPPER
+ popKeymap();
+#endif
+
if (didSaveState) {
_theme->disable();
restoreState();