diff options
author | Stephen Kennedy | 2008-08-18 19:54:46 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-18 19:54:46 +0000 |
commit | 34518951897d5b90d4d345f7f7465b4f86a67ed8 (patch) | |
tree | 309ced0bcf2107b821372a57711ed46db4a99528 /backends/keymapper/hardware-key.h | |
parent | 12d649f0113befdb7098962eabb7dd70e194a88b (diff) | |
download | scummvm-rg350-34518951897d5b90d4d345f7f7465b4f86a67ed8.tar.gz scummvm-rg350-34518951897d5b90d4d345f7f7465b4f86a67ed8.tar.bz2 scummvm-rg350-34518951897d5b90d4d345f7f7465b4f86a67ed8.zip |
Final changes to keymapper:
* HardwareKey's now have a type too, so that we can either match a key to an action or vice versa.
* Better test keymaps - with special gui keymap that is activated when a dialog is opened
svn-id: r34005
Diffstat (limited to 'backends/keymapper/hardware-key.h')
-rw-r--r-- | backends/keymapper/hardware-key.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h index 85badae3cc..082ecfc944 100644 --- a/backends/keymapper/hardware-key.h +++ b/backends/keymapper/hardware-key.h @@ -26,12 +26,12 @@ #ifndef COMMON_HARDWAREKEY #define COMMON_HARDWAREKEY -#include "backends/keymapper/action.h" +#include "backends/keymapper/types.h" namespace Common { -#define HWKEY_ID_SIZE (4) +#define HWKEY_ID_SIZE (4) /** * Describes an available hardware key */ @@ -46,14 +46,12 @@ struct HardwareKey { */ KeyState key; - ActionCategory preferredCategory; - ActionType preferredType; - int16 group; + KeyType type; + ActionType preferredAction; - HardwareKey(const char *i, KeyState ks = KeyState(), String des = "", - ActionCategory cat = kGenericActionCategory, - ActionType ty = kGenericActionType, int gr = 0) - : key(ks), description(des), preferredCategory(cat), preferredType(ty), group(gr) { + HardwareKey(const char *i, KeyState ky = KeyState(), String desc = "", + KeyType typ = kGenericKeyType, ActionType prefAct = kGenericActionType) + : key(ky), description(desc), type(typ), preferredAction(prefAct) { assert(i); strncpy(id, i, HWKEY_ID_SIZE); } @@ -113,8 +111,8 @@ private: void checkForKey(HardwareKey *key) { List<const HardwareKey*>::iterator it; for (it = _keys.begin(); it != _keys.end(); it++) { - if ((*it)->id == key->id) - error("Error adding HardwareKey '%s' - id of %d already in use!", key->description.c_str(), key->id); + if (strncmp((*it)->id, key->id, HWKEY_ID_SIZE) == 0) + error("Error adding HardwareKey '%s' - id of %s already in use!", key->description.c_str(), key->id); else if ((*it)->key == key->key) error("Error adding HardwareKey '%s' - key already in use!", key->description.c_str()); } |