diff options
Diffstat (limited to 'backends/keymapper/action.h')
-rw-r--r-- | backends/keymapper/action.h | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/backends/keymapper/action.h b/backends/keymapper/action.h index b15b3aaaad..5e69ed3918 100644 --- a/backends/keymapper/action.h +++ b/backends/keymapper/action.h @@ -27,7 +27,6 @@ #ifdef ENABLE_KEYMAPPER -#include "backends/keymapper/types.h" #include "common/events.h" #include "common/func.h" #include "common/list.h" @@ -35,11 +34,17 @@ namespace Common { -struct HardwareKey; +struct HardwareInput; class Keymap; #define ACTION_ID_SIZE (4) +struct KeyActionEntry { + const KeyState ks; + const char *id; + const char *description; +}; + struct Action { /** unique id used for saving/loading to config */ char id[ACTION_ID_SIZE]; @@ -48,27 +53,26 @@ struct Action { /** Events to be sent when mapped key is pressed */ List<Event> events; - ActionType type; - KeyType preferredKey; - int priority; - int group; - int flags; private: - /** Hardware key that is mapped to this Action */ - const HardwareKey *_hwKey; + /** Hardware input that is mapped to this Action */ + const HardwareInput *_hwInput; Keymap *_boss; public: - Action(Keymap *boss, const char *id, String des = "", - ActionType typ = kGenericActionType, - KeyType prefKey = kGenericKeyType, - int pri = 0, int flg = 0 ); + Action(Keymap *boss, const char *id, String des = ""); void addEvent(const Event &evt) { events.push_back(evt); } + void addEvent(const EventType evtType) { + Event evt; + + evt.type = evtType; + events.push_back(evt); + } + void addKeyEvent(const KeyState &ks) { Event evt; @@ -78,42 +82,24 @@ public: } void addLeftClickEvent() { - Event evt; - - evt.type = EVENT_LBUTTONDOWN; - addEvent(evt); + addEvent(EVENT_LBUTTONDOWN); } void addMiddleClickEvent() { - Event evt; - - evt.type = EVENT_MBUTTONDOWN; - addEvent(evt); + addEvent(EVENT_MBUTTONDOWN); } void addRightClickEvent() { - Event evt; - - evt.type = EVENT_RBUTTONDOWN; - addEvent(evt); + addEvent(EVENT_RBUTTONDOWN); } Keymap *getParent() { return _boss; } - void mapKey(const HardwareKey *key); - const HardwareKey *getMappedKey() const; - -}; + void mapInput(const HardwareInput *input); + const HardwareInput *getMappedInput() const; -struct ActionPriorityComp : public BinaryFunction<Action, Action, bool> { - bool operator()(const Action *x, const Action *y) const { - return x->priority > y->priority; - } - bool operator()(const Action &x, const Action &y) const { - return x.priority > y.priority; - } }; } // End of namespace Common |