KEYMAPPER: Make sure GuiManager only pops gui keymaps

This commit is contained in:
Tarek Soliman 2011-10-22 14:42:43 -05:00
parent a5082ffa5d
commit 56b5c0ea9f

View File

@ -133,7 +133,15 @@ void GuiManager::pushKeymap() {
}
void GuiManager::popKeymap() {
_system->getEventManager()->getKeymapper()->popKeymap();
Common::Keymapper *keymapper = _system->getEventManager()->getKeymapper();
if (!keymapper->getActiveStack().empty()) {
Common::Keymapper::MapRecord topKeymap = keymapper->getActiveStack().top();
// TODO: Don't use the keymap name as a way to discriminate GUI maps
if(topKeymap.keymap->getName().equals(Common::kGuiKeymapName))
keymapper->popKeymap();
else
warning("An attempt to pop non-gui keymap %s was blocked", topKeymap.keymap->getName().c_str());
}
}
#endif