aboutsummaryrefslogtreecommitdiff
path: root/backends/keymapper/remap-dialog.cpp
diff options
context:
space:
mode:
authorJody Northup2009-08-14 08:11:18 +0000
committerJody Northup2009-08-14 08:11:18 +0000
commit44e79803648ba7704e97031752506ad42176990d (patch)
treeee66857a57124de13f2d30c2d40a42e16f20343d /backends/keymapper/remap-dialog.cpp
parent7d9890ff2efb7547a4e141ccb7885f8b0b96f4c9 (diff)
downloadscummvm-rg350-44e79803648ba7704e97031752506ad42176990d.tar.gz
scummvm-rg350-44e79803648ba7704e97031752506ad42176990d.tar.bz2
scummvm-rg350-44e79803648ba7704e97031752506ad42176990d.zip
Added proper saving/loading of mapped key modifiers. Fixed modifier recognition in a much less hackish manner, (but still using a minor hack as a stopgap until KeyState can be replaced as the primary lookup type for the keymapper).
svn-id: r43363
Diffstat (limited to 'backends/keymapper/remap-dialog.cpp')
-rw-r--r--backends/keymapper/remap-dialog.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index 9341c82747..aca2630d6d 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -239,15 +239,14 @@ void RemapDialog::handleKeyDown(Common::KeyState state) {
void RemapDialog::handleKeyUp(Common::KeyState state) {
if (_activeRemapAction) {
const HardwareKey *hwkey = _keymapper->findHardwareKey(state);
- const HardwareMod *hwmod = _keymapper->findHardwareMod(state);
- debug(0, "Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
+ debug( "Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
if (hwkey) {
- HardwareKey *temphwkey = new HardwareKey(*hwkey);
- temphwkey->description = hwkey->description;
- temphwkey->key.flags = hwmod->modFlags;
- _activeRemapAction->mapKey(temphwkey);
+ HardwareKey *mappedkey = new HardwareKey(*hwkey);
+ mappedkey->description = hwkey->description;
+ mappedkey->key.flags = (state.flags & hwkey->modMask);
+ _activeRemapAction->mapKey(mappedkey);
_activeRemapAction->getParent()->saveMappings();
_changes = true;
stopRemapping();
@@ -363,8 +362,21 @@ void RemapDialog::refreshKeymap() {
const HardwareKey *mappedKey = info.action->getMappedKey();
if (mappedKey)
- widg.keyButton->setLabel(mappedKey->description);
- else
+ {
+ Common::String description = "";
+ if (mappedKey->key.flags)
+ {
+ byte flags = mappedKey->key.flags;
+ if (flags & KBD_CTRL)
+ description += "Ctrl+";
+ if (flags & KBD_SHIFT)
+ description += "Shift+";
+ if (flags & KBD_ALT)
+ description += "Alt+";
+ }
+ description += mappedKey->description;
+ widg.keyButton->setLabel(description);
+ } else
widg.keyButton->setLabel("-");
widg.actionText->setVisible(true);