diff options
| author | Jody Northup | 2009-08-16 07:40:13 +0000 |
|---|---|---|
| committer | Jody Northup | 2009-08-16 07:40:13 +0000 |
| commit | cbffcb609f752edcc3f086521c9e0c75b5ee4cc4 (patch) | |
| tree | e212df62509a74330dd231bd652cc9ff583c5fb5 /backends/keymapper/action.cpp | |
| parent | 43d57fd333afa54f4e85f30e2ef8231444988066 (diff) | |
| download | scummvm-rg350-cbffcb609f752edcc3f086521c9e0c75b5ee4cc4.tar.gz scummvm-rg350-cbffcb609f752edcc3f086521c9e0c75b5ee4cc4.tar.bz2 scummvm-rg350-cbffcb609f752edcc3f086521c9e0c75b5ee4cc4.zip | |
Replaced KeyStates with ActionKeys in the keymapper, removed SDL ASCII code mismatch workaround hacks, fixed the memory leaks I had previously created.
svn-id: r43430
Diffstat (limited to 'backends/keymapper/action.cpp')
| -rw-r--r-- | backends/keymapper/action.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/backends/keymapper/action.cpp b/backends/keymapper/action.cpp index 3feb593f19..1f4efbf457 100644 --- a/backends/keymapper/action.cpp +++ b/backends/keymapper/action.cpp @@ -43,14 +43,21 @@ Action::Action(Keymap *boss, const char *i, String des, ActionType typ, _boss->addAction(this); } -void Action::mapKey(const HardwareKey *key) { +void Action::mapKey(const HardwareKey *key, byte flags) { if (_hwKey) + { _boss->unregisterMapping(this); + delete _hwKey; + } - _hwKey = key; - - if (_hwKey) - _boss->registerMapping(this, _hwKey); + if (key) { + _hwKey = new HardwareKey(*key); + if (flags) + _hwKey->key.flags = flags & _hwKey->modMask; + if (_hwKey) + _boss->registerMapping(this, _hwKey); + } else + _hwKey = NULL; } const HardwareKey *Action::getMappedKey() const { |
