aboutsummaryrefslogtreecommitdiff
path: root/backends/keymapper/hardware-input.h
diff options
context:
space:
mode:
authorTarek Soliman2012-02-24 13:55:48 -0600
committerTarek Soliman2012-03-02 20:48:50 -0600
commit4ee1a3aceae7d68c89513f7d122606acbceb1e7c (patch)
tree0f9d3153b7f2f721f0d23e7bfce9e5fe8e287421 /backends/keymapper/hardware-input.h
parent101ec2b885aade21216c1bba8488711b30d192eb (diff)
downloadscummvm-rg350-4ee1a3aceae7d68c89513f7d122606acbceb1e7c.tar.gz
scummvm-rg350-4ee1a3aceae7d68c89513f7d122606acbceb1e7c.tar.bz2
scummvm-rg350-4ee1a3aceae7d68c89513f7d122606acbceb1e7c.zip
KEYMAPPER: Add non-key inputs to HardwareInput
Diffstat (limited to 'backends/keymapper/hardware-input.h')
-rw-r--r--backends/keymapper/hardware-input.h53
1 files changed, 41 insertions, 12 deletions
diff --git a/backends/keymapper/hardware-input.h b/backends/keymapper/hardware-input.h
index 9396765bbe..51d4accb5b 100644
--- a/backends/keymapper/hardware-input.h
+++ b/backends/keymapper/hardware-input.h
@@ -34,6 +34,15 @@
namespace Common {
+typedef uint32 HardwareInputCode;
+
+enum HardwareInputType {
+ /** Input that sends single events */
+ kHardwareInputTypeGeneric,
+ /** Input that usually send -up and -down events */
+ kHardwareInputTypeKeyboard
+};
+
/**
* Describes an available hardware input
*/
@@ -44,14 +53,33 @@ struct HardwareInput {
/** Human readable description */
String description;
+ const HardwareInputType type;
+
/**
- * The KeyState that is generated by the back-end
- * when this hardware key is pressed.
- */
+ * A platform specific unique identifier for an input event
+ * generated when this input is triggered.
+ * This is only relevant when type == kHardwareInputTypeGeneric
+ */
+ HardwareInputCode inputCode;
+
+ /**
+ * The KeyState that is generated by the back-end
+ * when this hardware key is pressed.
+ * This is only relevant when type == kHardwareInputTypeKeyboard
+ */
KeyState key;
- HardwareInput(String i, KeyState ky = KeyState(), String desc = "")
- : id(i), key(ky), description(desc) { }
+ HardwareInput(String i, HardwareInputCode ic = 0, String desc = "")
+ : id(i), inputCode(ic), description(desc), type(kHardwareInputTypeGeneric) { }
+
+ HardwareInput(String i, KeyState ky, String desc = "")
+ : id(i), key(ky), description(desc), type(kHardwareInputTypeKeyboard) { }
+};
+
+struct HardwareInputTableEntry {
+ const char *hwId;
+ HardwareInputCode code;
+ const char *desc;
};
/**
@@ -97,6 +125,8 @@ public:
const HardwareInput *findHardwareInput(String id) const;
+ const HardwareInput *findHardwareInput(const HardwareInputCode code) const;
+
const HardwareInput *findHardwareInput(const KeyState& keystate) const;
const List<const HardwareInput *> &getHardwareInputs() const { return _inputs; }
@@ -104,18 +134,17 @@ public:
uint size() const { return _inputs.size(); }
/**
- * Add hardware inputs to the set out of key and modifier tables.
- * @param keys table of available keys
- * @param modifiers table of available modifiers
+ * Add hardware inputs to the set out of a table.
+ * @param inputs table of available inputs
*/
- void addHardwareInputs(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]);
+ void addHardwareInputs(const HardwareInputTableEntry inputs[]);
/**
- * Add hardware inputs to the set out of a key table.
- * The default modifiers are applied to the key entries
+ * Add hardware inputs to the set out of key and modifier tables.
* @param keys table of available keys
+ * @param modifiers table of available modifiers
*/
- void addHardwareInputs(const KeyTableEntry keys[]);
+ void addHardwareInputs(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]);
void removeHardwareInput(const HardwareInput *input);