[Scummvm-cvs-logs] scummvm master -> 06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0

tsoliman tarek at bashasoliman.com
Thu Feb 9 09:50:46 CET 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
06b5299461 KEYMAPPER: Fix re-selecting the top keymap


Commit: 06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0
    https://github.com/scummvm/scummvm/commit/06b52994619fb9a7ef9e54e50b5cc67d07f6a0a0
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2012-02-09T00:49:21-08:00

Commit Message:
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.

Changed paths:
    backends/keymapper/remap-dialog.cpp
    backends/keymapper/remap-dialog.h



diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index bf4144a..4b95a1a 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 1cb930b..143deca 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






More information about the Scummvm-git-logs mailing list