aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTarek Soliman2012-02-09 02:42:53 -0600
committerTarek Soliman2012-02-09 02:49:21 -0600
commit06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0 (patch)
treea627027a7f9f10d2dc2f4909814d627a6d6c017e
parent38dea529e8bfa3ae88011751f6c35c02dfe61668 (diff)
downloadscummvm-rg350-06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0.tar.gz
scummvm-rg350-06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0.tar.bz2
scummvm-rg350-06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0.zip
KEYMAPPER: Fix re-selecting the top keymap
Re-selecting the top entry would always populate the actions from the GUI keymap since it is the active keymap (the remap dialog itself is GUI) The top keymap was correct during RemapDialog::open() because the gui keymap had not been pushed to the stack yet.
-rw-r--r--backends/keymapper/remap-dialog.cpp9
-rw-r--r--backends/keymapper/remap-dialog.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index bf4144a59f..4b95a1a021 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -39,7 +39,7 @@ enum {
};
RemapDialog::RemapDialog()
- : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0) {
+ : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0), _topKeymapIsGui(false) {
_keymapper = g_system->getEventManager()->getKeymapper();
assert(_keymapper);
@@ -61,6 +61,8 @@ void RemapDialog::open() {
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
if (activeKeymaps.size() > 0) {
+ if (activeKeymaps.top().keymap->getName() == Common::kGuiKeymapName)
+ _topKeymapIsGui = true;
_kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Effective)"));
divider = true;
}
@@ -325,6 +327,11 @@ void RemapDialog::loadKeymap() {
int topIndex = activeKeymaps.size() - 1;
+ // This is a WORKAROUND for changing the popup list selected item and changing it back
+ // to the top entry. Upon changing it back, the top keymap is always "gui".
+ if (!_topKeymapIsGui && activeKeymaps[topIndex].keymap->getName() == kGuiKeymapName)
+ --topIndex;
+
// add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps[topIndex];
List<Action*>::iterator actIt;
diff --git a/backends/keymapper/remap-dialog.h b/backends/keymapper/remap-dialog.h
index 1cb930bd42..143deca4cf 100644
--- a/backends/keymapper/remap-dialog.h
+++ b/backends/keymapper/remap-dialog.h
@@ -91,6 +91,8 @@ protected:
bool _changes;
+ bool _topKeymapIsGui;
+
};
} // End of namespace Common