aboutsummaryrefslogtreecommitdiff
path: root/backends/keymapper/action.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/keymapper/action.cpp')
-rw-r--r--backends/keymapper/action.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/backends/keymapper/action.cpp b/backends/keymapper/action.cpp
index 3feb593f19..4633f20df3 100644
--- a/backends/keymapper/action.cpp
+++ b/backends/keymapper/action.cpp
@@ -32,9 +32,9 @@
namespace Common {
Action::Action(Keymap *boss, const char *i, String des, ActionType typ,
- KeyType prefKey, int pri, int flg)
+ KeyType prefKey, int pri)
: _boss(boss), description(des), type(typ), preferredKey(prefKey),
- priority(pri), flags(flg), _hwKey(0) {
+ priority(pri), _hwKey(0) {
assert(i);
assert(_boss);
@@ -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 {