From 73160e54b43180b1fcc8f9de0a548e5817d0d1cd Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Sat, 7 Jan 2012 20:48:49 -0600 Subject: 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. --- gui/gui-manager.cpp | 20 +++++++------------- 1 file 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(); -- cgit v1.2.3