aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();