From cbffcb609f752edcc3f086521c9e0c75b5ee4cc4 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Sun, 16 Aug 2009 07:40:13 +0000 Subject: 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 --- backends/keymapper/action.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'backends/keymapper/action.cpp') 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 { -- cgit v1.2.3