KEYMAPPER: Debugging and minor cleanup

This commit is contained in:
Tarek Soliman 2011-10-15 01:45:44 -05:00
parent a69340bd59
commit e4f1277913
2 changed files with 9 additions and 6 deletions

View File

@ -192,10 +192,10 @@ bool Keymapper::mapKey(const KeyState& key, bool keyDown) {
// Search for key in active keymap stack // Search for key in active keymap stack
for (int i = _activeMaps.size() - 1; i >= 0; --i) { for (int i = _activeMaps.size() - 1; i >= 0; --i) {
MapRecord mr = _activeMaps[i]; MapRecord mr = _activeMaps[i];
debug(5, "Keymapper::mapKey keymap: %s", mr.keymap->getName().c_str());
action = mr.keymap->getMappedAction(key); action = mr.keymap->getMappedAction(key);
if (action || mr.inherit == false) if (action || !mr.inherit)
break; break;
} }

View File

@ -84,7 +84,7 @@ void RemapDialog::open() {
keymapCount += _gameKeymaps->size(); keymapCount += _gameKeymaps->size();
} }
debug(3, "keymaps: %d", keymapCount); debug(3, "RemapDialog::open keymaps: %d", keymapCount);
_keymapTable = (Keymap **)malloc(sizeof(Keymap*) * keymapCount); _keymapTable = (Keymap **)malloc(sizeof(Keymap*) * keymapCount);
@ -192,7 +192,7 @@ void RemapDialog::reflowLayout() {
} }
void RemapDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { void RemapDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
debug(0, "Command!"); debug(3, "RemapDialog::handleCommand");
if (cmd >= kRemapCmd && cmd < kRemapCmd + _keymapWidgets.size()) { if (cmd >= kRemapCmd && cmd < kRemapCmd + _keymapWidgets.size()) {
startRemapping(cmd - kRemapCmd); startRemapping(cmd - kRemapCmd);
@ -240,7 +240,7 @@ void RemapDialog::handleKeyUp(Common::KeyState state) {
if (_activeRemapAction) { if (_activeRemapAction) {
const HardwareKey *hwkey = _keymapper->findHardwareKey(state); const HardwareKey *hwkey = _keymapper->findHardwareKey(state);
debug(0, "Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags); debug(4, "RemapDialog::handleKeyUp Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
if (hwkey) { if (hwkey) {
_activeRemapAction->mapKey(hwkey); _activeRemapAction->mapKey(hwkey);
@ -270,6 +270,8 @@ void RemapDialog::loadKeymap() {
_currentActions.clear(); _currentActions.clear();
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack(); const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
debug(3, "RemapDialog::loadKeymap active keymaps: %u", activeKeymaps.size());
if (!activeKeymaps.empty() && _kmPopUp->getSelected() == 0) { if (!activeKeymaps.empty() && _kmPopUp->getSelected() == 0) {
// load active keymaps // load active keymaps
@ -278,7 +280,7 @@ void RemapDialog::loadKeymap() {
// add most active keymap's keys // add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps.top(); Keymapper::MapRecord top = activeKeymaps.top();
List<Action*>::iterator actIt; List<Action*>::iterator actIt;
debug(3, "RemapDialog::loadKeymap top keymap: %s", top.keymap->getName().c_str());
for (actIt = top.keymap->getActions().begin(); actIt != top.keymap->getActions().end(); ++actIt) { for (actIt = top.keymap->getActions().begin(); actIt != top.keymap->getActions().end(); ++actIt) {
Action *act = *actIt; Action *act = *actIt;
ActionInfo info = {act, false, act->description}; ActionInfo info = {act, false, act->description};
@ -293,6 +295,7 @@ void RemapDialog::loadKeymap() {
if (top.inherit) { if (top.inherit) {
for (int i = activeKeymaps.size() - 2; i >= 0; --i) { for (int i = activeKeymaps.size() - 2; i >= 0; --i) {
Keymapper::MapRecord mr = activeKeymaps[i]; Keymapper::MapRecord mr = activeKeymaps[i];
debug(3, "RemapDialog::loadKeymap keymap: %s", mr.keymap->getName().c_str());
List<const HardwareKey*>::iterator keyIt = freeKeys.begin(); List<const HardwareKey*>::iterator keyIt = freeKeys.begin();
while (keyIt != freeKeys.end()) { while (keyIt != freeKeys.end()) {