aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTarek Soliman2012-01-07 20:48:49 -0600
committerTarek Soliman2012-01-07 20:48:49 -0600
commit73160e54b43180b1fcc8f9de0a548e5817d0d1cd (patch)
tree1c97cd7f2a73839736568e09755e3b067e7b8a56
parent15ea73104c051a034c39e12d19c96af720ca64b6 (diff)
downloadscummvm-rg350-73160e54b43180b1fcc8f9de0a548e5817d0d1cd.tar.gz
scummvm-rg350-73160e54b43180b1fcc8f9de0a548e5817d0d1cd.tar.bz2
scummvm-rg350-73160e54b43180b1fcc8f9de0a548e5817d0d1cd.zip
KEYMAPPER: Only push/pop the gui keymap once per gui session
The removes a bit of waste when gui dialogs are opened. Multiple gui keymaps were being pushed.
-rw-r--r--gui/gui-manager.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 3a665009cb..a9b8085c52 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -285,15 +285,6 @@ 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()) {
@@ -405,10 +396,6 @@ void GuiManager::runLoop() {
_system->delayMillis(10);
}
-#ifdef ENABLE_KEYMAPPER
- popKeymap();
-#endif
-
if (didSaveState) {
_theme->disable();
restoreState();
@@ -419,6 +406,10 @@ void GuiManager::runLoop() {
#pragma mark -
void GuiManager::saveState() {
+#ifdef ENABLE_KEYMAPPER
+ initKeymap();
+ pushKeymap();
+#endif
// Backup old cursor
_lastClick.x = _lastClick.y = 0;
_lastClick.time = 0;
@@ -428,6 +419,9 @@ void GuiManager::saveState() {
}
void GuiManager::restoreState() {
+#ifdef ENABLE_KEYMAPPER
+ popKeymap();
+#endif
if (_useStdCursor) {
CursorMan.popCursor();
CursorMan.popCursorPalette();