aboutsummaryrefslogtreecommitdiff
path: root/backends/keymapper/keymap.h
diff options
context:
space:
mode:
Diffstat (limited to 'backends/keymapper/keymap.h')
-rw-r--r--backends/keymapper/keymap.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h
index 615fd9097d..f4ad8d110d 100644
--- a/backends/keymapper/keymap.h
+++ b/backends/keymapper/keymap.h
@@ -36,6 +36,7 @@
#include "common/keyboard.h"
#include "common/list.h"
#include "backends/keymapper/action.h"
+#include "backends/keymapper/hardware-key.h"
namespace Common {
@@ -53,6 +54,17 @@ template<> struct Hash<KeyState>
}
};
+/**
+ * Hash function for ActionKey
+ */
+template<> struct Hash<ActionKey>
+ : public UnaryFunction<ActionKey, uint> {
+
+ uint operator()(const ActionKey &val) const {
+ return (uint)val.keycode | ((uint)val.flags << 24);
+ }
+};
+
class Keymap {
public:
Keymap(const String& name, Keymap *parent = 0) : _name(name), _parent(parent) {}
@@ -77,7 +89,7 @@ public:
* @param key the key that is mapped to the required Action
* @return a pointer to the Action or 0 if no
*/
- Action *getMappedAction(const KeyState& ks) const;
+ Action *getMappedAction(const ActionKey& ks) const;
void setConfigDomain(ConfigManager::Domain *dom);
@@ -90,7 +102,6 @@ public:
/**
* Save this keymap's mappings to the config manager
* @note Changes are *not* flushed to disk, to do so call ConfMan.flushToDisk()
- * @note Changes are *not* flushed to disk, to do so call ConfMan.flushToDisk()
*/
void saveMappings();
@@ -136,12 +147,12 @@ private:
void internalMapKey(Action *action, HardwareKey *hwKey);
- Action *getParentMappedAction(KeyState key);
+ Action *getParentMappedAction(const ActionKey &key);
String _name;
Keymap *_parent;
List<Action*> _actions;
- HashMap<KeyState, Action*> _keymap;
+ HashMap<ActionKey, Action*> _keymap;
ConfigManager::Domain *_configDomain;
};