[Scummvm-cvs-logs] scummvm master -> 6afac4e01eba5c297e99597dd2cb17c2e4732a7e

tsoliman tarek at bashasoliman.com
Mon Feb 27 20:03:01 CET 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6afac4e01e KEYMAPPER: Rename HardwareKey to HardwareInput


Commit: 6afac4e01eba5c297e99597dd2cb17c2e4732a7e
    https://github.com/scummvm/scummvm/commit/6afac4e01eba5c297e99597dd2cb17c2e4732a7e
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2012-02-27T11:00:56-08:00

Commit Message:
KEYMAPPER: Rename HardwareKey to HardwareInput

Changed paths:
  A backends/keymapper/hardware-input.h
  R backends/keymapper/hardware-key.h
    backends/keymapper/action.cpp
    backends/keymapper/action.h
    backends/keymapper/keymap.cpp
    backends/keymapper/keymap.h
    backends/keymapper/keymapper-defaults.h
    backends/keymapper/keymapper.cpp
    backends/keymapper/keymapper.h
    backends/keymapper/remap-dialog.cpp
    backends/platform/android/events.cpp
    backends/platform/linuxmoto/hardwarekeys.cpp
    backends/platform/linuxmoto/linuxmoto-sdl.h
    backends/platform/maemo/maemo-keys.h
    backends/platform/maemo/maemo.cpp
    backends/platform/maemo/maemo.h
    backends/platform/sdl/hardwarekeys.cpp
    backends/platform/sdl/sdl.h
    backends/platform/webos/webos.cpp
    backends/platform/webos/webos.h
    base/main.cpp
    common/system.h



diff --git a/backends/keymapper/action.cpp b/backends/keymapper/action.cpp
index e5b2d94..33f5c42 100644
--- a/backends/keymapper/action.cpp
+++ b/backends/keymapper/action.cpp
@@ -29,7 +29,7 @@
 namespace Common {
 
 Action::Action(Keymap *boss, const char *i,	String des)
-	: _boss(boss), description(des), _hwKey(0) {
+	: _boss(boss), description(des), _hwInput(0) {
 	assert(i);
 	assert(_boss);
 
@@ -38,18 +38,18 @@ Action::Action(Keymap *boss, const char *i,	String des)
 	_boss->addAction(this);
 }
 
-void Action::mapKey(const HardwareKey *key) {
-	if (_hwKey)
+void Action::mapInput(const HardwareInput *input) {
+	if (_hwInput)
 		_boss->unregisterMapping(this);
 
-	_hwKey = key;
+	_hwInput = input;
 
-	if (_hwKey)
-		_boss->registerMapping(this, _hwKey);
+	if (_hwInput)
+		_boss->registerMapping(this, _hwInput);
 }
 
-const HardwareKey *Action::getMappedKey() const {
-	return _hwKey;
+const HardwareInput *Action::getMappedInput() const {
+	return _hwInput;
 }
 
 } // End of namespace Common
diff --git a/backends/keymapper/action.h b/backends/keymapper/action.h
index 3132260..5e69ed3 100644
--- a/backends/keymapper/action.h
+++ b/backends/keymapper/action.h
@@ -34,7 +34,7 @@
 
 namespace Common {
 
-struct HardwareKey;
+struct HardwareInput;
 class Keymap;
 
 #define ACTION_ID_SIZE (4)
@@ -55,8 +55,8 @@ struct Action {
 	List<Event> events;
 
 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:
@@ -97,8 +97,8 @@ public:
 		return _boss;
 	}
 
-	void mapKey(const HardwareKey *key);
-	const HardwareKey *getMappedKey() const;
+	void mapInput(const HardwareInput *input);
+	const HardwareInput *getMappedInput() const;
 
 };
 
diff --git a/backends/keymapper/hardware-input.h b/backends/keymapper/hardware-input.h
new file mode 100644
index 0000000..70e0f98
--- /dev/null
+++ b/backends/keymapper/hardware-input.h
@@ -0,0 +1,187 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#ifndef COMMON_HARDWARE_KEY_H
+#define COMMON_HARDWARE_KEY_H
+
+#include "common/scummsys.h"
+
+#ifdef ENABLE_KEYMAPPER
+
+#include "common/textconsole.h"
+
+namespace Common {
+
+/**
+* Describes an available hardware input
+*/
+struct HardwareInput {
+	/** unique id used for saving/loading to config */
+	String id;
+
+	/** Human readable description */
+	String description;
+
+	/**
+	* The KeyState that is generated by the back-end
+	* when this hardware key is pressed.
+	*/
+	KeyState key;
+
+	HardwareInput(String i, KeyState ky = KeyState(), String desc = "")
+		: id(i), key(ky), description(desc) { }
+};
+
+/**
+ * Entry in a static table of available non-modifier keys
+ */
+struct KeyTableEntry {
+	const char *hwId;
+	KeyCode keycode;
+	uint16 ascii;
+	const char *desc;
+	bool shiftable;
+};
+
+/**
+ * Entry in a static table of available key modifiers
+ */
+struct ModifierTableEntry {
+	byte flag;
+	const char *id;
+	const char *desc;
+	bool shiftable;
+};
+
+/**
+ * Simple class to encapsulate a device's set of HardwareInputs.
+ * Each device should instantiate this and call addHardwareInput a number of times
+ * in its constructor to define the device's available keys.
+ */
+class HardwareInputSet {
+public:
+
+	/**
+	 * Add hardware input keys to the set out of key and modifier tables.
+	 * @param keys       table of available keys
+	 * @param modifiers  table of available modifiers
+	 */
+	HardwareInputSet(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
+		addHardwareInputs(keys, modifiers);
+	}
+
+	HardwareInputSet() { }
+
+	virtual ~HardwareInputSet() {
+		List<const HardwareInput *>::const_iterator it;
+
+		for (it = _inputs.begin(); it != _inputs.end(); it++)
+			delete *it;
+	}
+
+	void addHardwareInput(const HardwareInput *input) {
+		checkForInput(input);
+		_inputs.push_back(input);
+	}
+
+	const HardwareInput *findHardwareInput(String id) const {
+		List<const HardwareInput *>::const_iterator it;
+
+		for (it = _inputs.begin(); it != _inputs.end(); it++) {
+			if ((*it)->id == id)
+				return (*it);
+		}
+		return 0;
+	}
+
+	const HardwareInput *findHardwareInput(const KeyState& keystate) const {
+		List<const HardwareInput *>::const_iterator it;
+
+		for (it = _inputs.begin(); it != _inputs.end(); it++) {
+			if ((*it)->key == keystate)
+				return (*it);
+		}
+		return 0;
+	}
+
+	const List<const HardwareInput *> &getHardwareInputs() const {
+		return _inputs;
+	}
+
+	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
+	 */
+	void addHardwareInputs(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
+		const KeyTableEntry *key;
+		const ModifierTableEntry *mod;
+		char fullKeyId[50];
+		char fullKeyDesc[100];
+		uint16 ascii;
+
+		for (mod = modifiers; mod->id; mod++) {
+			for (key = keys; key->hwId; key++) {
+				ascii = key->ascii;
+
+				if (mod->shiftable && key->shiftable) {
+					snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
+					snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
+					ascii = toupper(key->ascii);
+				} else if (mod->shiftable) {
+					snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
+					snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
+				} else {
+					snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
+					snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
+				}
+
+				addHardwareInput(new HardwareInput(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc));
+			}
+		}
+	}
+
+private:
+
+	void checkForInput(const HardwareInput *input) {
+		List<const HardwareInput *>::iterator it;
+
+		for (it = _inputs.begin(); it != _inputs.end(); it++) {
+			if ((*it)->id == input->id)
+				error("Error adding HardwareInput '%s' - id of %s already in use!", input->description.c_str(), input->id.c_str());
+			else if ((*it)->key == input->key)
+				error("Error adding HardwareInput '%s' - key already in use!", input->description.c_str());
+		}
+	}
+
+	List<const HardwareInput *> _inputs;
+};
+
+} // End of namespace Common
+
+#endif // #ifdef ENABLE_KEYMAPPER
+
+#endif // #ifndef COMMON_HARDWARE_KEY_H
diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h
deleted file mode 100644
index 9fd8d19..0000000
--- a/backends/keymapper/hardware-key.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-*/
-
-#ifndef COMMON_HARDWARE_KEY_H
-#define COMMON_HARDWARE_KEY_H
-
-#include "common/scummsys.h"
-
-#ifdef ENABLE_KEYMAPPER
-
-#include "common/textconsole.h"
-
-namespace Common {
-
-/**
-* Describes an available hardware key
-*/
-struct HardwareKey {
-	/** unique id used for saving/loading to config */
-	String id;
-
-	/** Human readable description */
-	String description;
-
-	/**
-	* The KeyState that is generated by the back-end
-	* when this hardware key is pressed.
-	*/
-	KeyState key;
-
-	HardwareKey(String i, KeyState ky = KeyState(), String desc = "")
-		: id(i), key(ky), description(desc) { }
-};
-
-/**
- * Entry in a static table of available non-modifier keys
- */
-struct KeyTableEntry {
-	const char *hwId;
-	KeyCode keycode;
-	uint16 ascii;
-	const char *desc;
-	bool shiftable;
-};
-
-/**
- * Entry in a static table of available key modifiers
- */
-struct ModifierTableEntry {
-	byte flag;
-	const char *id;
-	const char *desc;
-	bool shiftable;
-};
-
-/**
- * Simple class to encapsulate a device's set of HardwareKeys.
- * Each device should instantiate this and call addHardwareKey a number of times
- * in its constructor to define the device's available keys.
- */
-class HardwareKeySet {
-public:
-
-	/**
-	 * Add hardware keys to the set out of key and modifier tables.
-	 * @param keys       table of available keys
-	 * @param modifiers  table of available modifiers
-	 */
-	HardwareKeySet(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
-		addHardwareKeys(keys, modifiers);
-	}
-
-	HardwareKeySet() { }
-
-	virtual ~HardwareKeySet() {
-		List<const HardwareKey *>::const_iterator it;
-
-		for (it = _keys.begin(); it != _keys.end(); it++)
-			delete *it;
-	}
-
-	void addHardwareKey(const HardwareKey *key) {
-		checkForKey(key);
-		_keys.push_back(key);
-	}
-
-	const HardwareKey *findHardwareKey(String id) const {
-		List<const HardwareKey *>::const_iterator it;
-
-		for (it = _keys.begin(); it != _keys.end(); it++) {
-			if ((*it)->id == id)
-				return (*it);
-		}
-		return 0;
-	}
-
-	const HardwareKey *findHardwareKey(const KeyState& keystate) const {
-		List<const HardwareKey *>::const_iterator it;
-
-		for (it = _keys.begin(); it != _keys.end(); it++) {
-			if ((*it)->key == keystate)
-				return (*it);
-		}
-		return 0;
-	}
-
-	const List<const HardwareKey *> &getHardwareKeys() const {
-		return _keys;
-	}
-
-	uint size() const {
-		return _keys.size();
-	}
-
-	/**
-	 * Add hardware keys to the set out of key and modifier tables.
-	 * @param keys       table of available keys
-	 * @param modifiers  table of available modifiers
-	 */
-	void addHardwareKeys(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
-		const KeyTableEntry *key;
-		const ModifierTableEntry *mod;
-		char fullKeyId[50];
-		char fullKeyDesc[100];
-		uint16 ascii;
-
-		for (mod = modifiers; mod->id; mod++) {
-			for (key = keys; key->hwId; key++) {
-				ascii = key->ascii;
-
-				if (mod->shiftable && key->shiftable) {
-					snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
-					snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
-					ascii = toupper(key->ascii);
-				} else if (mod->shiftable) {
-					snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
-					snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
-				} else {
-					snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
-					snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
-				}
-
-				addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc));
-			}
-		}
-	}
-
-private:
-
-	void checkForKey(const 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 %s already in use!", key->description.c_str(), key->id.c_str());
-			else if ((*it)->key == key->key)
-				error("Error adding HardwareKey '%s' - key already in use!", key->description.c_str());
-		}
-	}
-
-	List<const HardwareKey *> _keys;
-};
-
-} // End of namespace Common
-
-#endif // #ifdef ENABLE_KEYMAPPER
-
-#endif // #ifndef COMMON_HARDWARE_KEY_H
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 3913fd1..8ea975c 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -26,7 +26,7 @@
 
 #include "common/system.h"
 
-#include "backends/keymapper/hardware-key.h"
+#include "backends/keymapper/hardware-input.h"
 #include "backends/keymapper/keymapper-defaults.h"
 
 #define KEYMAP_KEY_PREFIX "keymap_"
@@ -37,10 +37,10 @@ Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDoma
 	List<Action *>::iterator it;
 
 	for (it = _actions.begin(); it != _actions.end(); ++it) {
-		const HardwareKey *hwKey = (*it)->getMappedKey();
+		const HardwareInput *hwInput = (*it)->getMappedInput();
 
-		if (hwKey) {
-			_keymap[hwKey->key] = *it;
+		if (hwInput) {
+			_keymap[hwInput->key] = *it;
 		}
 	}
 }
@@ -59,24 +59,24 @@ void Keymap::addAction(Action *action) {
 	_actions.push_back(action);
 }
 
-void Keymap::registerMapping(Action *action, const HardwareKey *hwKey) {
+void Keymap::registerMapping(Action *action, const HardwareInput *hwInput) {
 	HashMap<KeyState, Action *>::iterator it;
 
-	it = _keymap.find(hwKey->key);
+	it = _keymap.find(hwInput->key);
 
 	// if key is already mapped to a different action then un-map it
 	if (it != _keymap.end() && action != it->_value) {
-		it->_value->mapKey(0);
+		it->_value->mapInput(0);
 	}
 
-	_keymap[hwKey->key] = action;
+	_keymap[hwInput->key] = action;
 }
 
 void Keymap::unregisterMapping(Action *action) {
-	const HardwareKey *hwKey = action->getMappedKey();
+	const HardwareInput *hwInput = action->getMappedInput();
 
-	if (hwKey) {
-		_keymap.erase(hwKey->key);
+	if (hwInput) {
+		_keymap.erase(hwInput->key);
 	}
 }
 
@@ -120,7 +120,7 @@ void Keymap::setConfigDomain(ConfigManager::Domain *dom) {
 	_configDomain = dom;
 }
 
-void Keymap::loadMappings(const HardwareKeySet *hwKeys) {
+void Keymap::loadMappings(const HardwareInputSet *hwKeys) {
 	if (!_configDomain)
 		return;
 
@@ -129,7 +129,7 @@ void Keymap::loadMappings(const HardwareKeySet *hwKeys) {
 
 	Common::KeymapperDefaultBindings *defaults = g_system->getKeymapperDefaultBindings();
 
-	HashMap<String, const HardwareKey *> mappedKeys;
+	HashMap<String, const HardwareInput *> mappedInputs;
 	List<Action*>::iterator it;
 	String prefix = KEYMAP_KEY_PREFIX + _name + "_";
 
@@ -138,37 +138,37 @@ void Keymap::loadMappings(const HardwareKeySet *hwKeys) {
 		String actionId(ua->id);
 		String confKey = prefix + actionId;
 
-		String hwKeyId = _configDomain->getVal(confKey);
+		String hwInputId = _configDomain->getVal(confKey);
 
 		bool defaulted = false;
 		// fall back to the platform-specific defaults
-		if (hwKeyId.empty() && defaults) {
-			hwKeyId = defaults->getDefaultBinding(_name, actionId);
-			if (!hwKeyId.empty())
+		if (hwInputId.empty() && defaults) {
+			hwInputId = defaults->getDefaultBinding(_name, actionId);
+			if (!hwInputId.empty())
 				defaulted = true;
 		}
 		// there's no mapping
-		if (hwKeyId.empty())
+		if (hwInputId.empty())
 			continue;
 
-		const HardwareKey *hwKey = hwKeys->findHardwareKey(hwKeyId.c_str());
+		const HardwareInput *hwInput = hwKeys->findHardwareInput(hwInputId.c_str());
 
-		if (!hwKey) {
-			warning("HardwareKey with ID '%s' not known", hwKeyId.c_str());
+		if (!hwInput) {
+			warning("HardwareInput with ID '%s' not known", hwInputId.c_str());
 			continue;
 		}
 
 		if (defaulted) {
-			if (mappedKeys.contains(hwKeyId)) {
-				debug(1, "Action [%s] not falling back to hardcoded default value [%s] because the key is in use", confKey.c_str(), hwKeyId.c_str());
+			if (mappedInputs.contains(hwInputId)) {
+				debug(1, "Action [%s] not falling back to hardcoded default value [%s] because the hardware input is in use", confKey.c_str(), hwInputId.c_str());
 				continue;
 			}
-			warning("Action [%s] fell back to hardcoded default value [%s]", confKey.c_str(), hwKeyId.c_str());
+			warning("Action [%s] fell back to hardcoded default value [%s]", confKey.c_str(), hwInputId.c_str());
 		}
 
-		mappedKeys.setVal(hwKeyId, hwKey);
+		mappedInputs.setVal(hwInputId, hwInput);
 		// map the key
-		ua->mapKey(hwKey);
+		ua->mapInput(hwInput);
 	}
 }
 
@@ -187,27 +187,27 @@ void Keymap::saveMappings() {
 		String actId((*it)->id, (*it)->id + actIdLen);
 		String hwId = "";
 
-		if ((*it)->getMappedKey()) {
-			hwId = (*it)->getMappedKey()->id;
+		if ((*it)->getMappedInput()) {
+			hwId = (*it)->getMappedInput()->id;
 		}
 		_configDomain->setVal(prefix + actId, hwId);
 	}
 }
 
-bool Keymap::isComplete(const HardwareKeySet *hwKeys) {
+bool Keymap::isComplete(const HardwareInputSet *hwInputs) {
 	List<Action *>::iterator it;
 	bool allMapped = true;
 	uint numberMapped = 0;
 
 	for (it = _actions.begin(); it != _actions.end(); ++it) {
-		if ((*it)->getMappedKey()) {
-			numberMapped++;
+		if ((*it)->getMappedInput()) {
+			++numberMapped;
 		} else {
 			allMapped = false;
 		}
 	}
 
-	return allMapped || (numberMapped == hwKeys->size());
+	return allMapped || (numberMapped == hwInputs->size());
 }
 
 } // End of namespace Common
diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h
index 2e9f085..4c3e897 100644
--- a/backends/keymapper/keymap.h
+++ b/backends/keymapper/keymap.h
@@ -36,8 +36,8 @@
 
 namespace Common {
 
-struct HardwareKey;
-class HardwareKeySet;
+struct HardwareInput;
+class HardwareInputSet;
 
 /**
  * Hash function for KeyState
@@ -80,9 +80,9 @@ public:
 
 	/**
 	 * Load this keymap's mappings from the config manager.
-	 * @param hwKeys	the set to retrieve hardware key pointers from
+	 * @param hwInputs	the set to retrieve hardware input pointers from
 	 */
-	void loadMappings(const HardwareKeySet *hwKeys);
+	void loadMappings(const HardwareInputSet *hwInputs);
 
 	/**
 	 * Save this keymap's mappings to the config manager
@@ -93,9 +93,9 @@ public:
 
 	/**
 	 * Returns true if all UserAction's in Keymap are mapped, or,
-	 * all HardwareKey's from the given set have been used up.
+	 * all HardwareInputs from the given set have been used up.
 	 */
-	bool isComplete(const HardwareKeySet *hwKeys);
+	bool isComplete(const HardwareInputSet *hwInputs);
 
 	const String& getName() { return _name; }
 
@@ -110,15 +110,15 @@ private:
 	void addAction(Action *action);
 
 	/**
-	* Registers a HardwareKey to the given Action
+	* Registers a HardwareInput to the given Action
 	* @param action Action in this Keymap
-	* @param key pointer to HardwareKey to map
+	* @param key pointer to HardwareInput to map
 	* @see Action::mapKey
 	*/
-	void registerMapping(Action *action, const HardwareKey *key);
+	void registerMapping(Action *action, const HardwareInput *input);
 
 	/**
-	* Unregisters a HardwareKey from the given Action (if one is mapped)
+	* Unregisters a HardwareInput from the given Action (if one is mapped)
 	* @param action Action in this Keymap
 	* @see Action::mapKey
 	*/
diff --git a/backends/keymapper/keymapper-defaults.h b/backends/keymapper/keymapper-defaults.h
index 5b84ebe..bd4afd4 100644
--- a/backends/keymapper/keymapper-defaults.h
+++ b/backends/keymapper/keymapper-defaults.h
@@ -35,17 +35,17 @@ namespace Common {
 class KeymapperDefaultBindings : HashMap<String, String> {
 public:
 	/**
-	 * This sets a default hwKey for a given Keymap Action
+	 * This sets a default hwInput for a given Keymap Action
 	 * @param keymapId String representing Keymap id (Keymap.name)
 	 * @param actionId String representing Action id (Action.id)
-	 * @param hwKeyId String representing the HardwareKey id (HardwareKey.hwKeyId)
+	 * @param hwInputId String representing the HardwareInput id (HardwareInput.id)
 	 */
-	void setDefaultBinding(String keymapId, String actionId, String hwKeyId) { setVal(keymapId + "_" + actionId, hwKeyId); }
+	void setDefaultBinding(String keymapId, String actionId, String hwInputId) { setVal(keymapId + "_" + actionId, hwInputId); }
 	/**
 	 * This retrieves the assigned default hwKey for a given Keymap Action
 	 * @param keymapId String representing Keymap id (Keymap.name)
 	 * @param actionId String representing Action id (Action.id)
-	 * @return hwKeyId String representing the HardwareKey id (HardwareKey.hwKeyId)
+	 * @return String representing the HardwareInput id (HardwareInput.id)
 	 */
 	String getDefaultBinding(String keymapId, String actionId) { return getVal(keymapId + "_" + actionId); }
 };
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index 189f862..719902e 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -54,26 +54,26 @@ Keymap *Keymapper::Domain::getKeymap(const String& name) {
 }
 
 Keymapper::Keymapper(EventManager *evtMgr)
-	: _eventMan(evtMgr), _enabled(true), _hardwareKeys(0) {
+	: _eventMan(evtMgr), _enabled(true), _hardwareInputs(0) {
 	ConfigManager::Domain *confDom = ConfMan.getDomain(ConfigManager::kKeymapperDomain);
 
 	_globalDomain.setConfigDomain(confDom);
 }
 
 Keymapper::~Keymapper() {
-	delete _hardwareKeys;
+	delete _hardwareInputs;
 }
 
-void Keymapper::registerHardwareKeySet(HardwareKeySet *keys) {
-	if (_hardwareKeys)
-		error("Hardware key set already registered");
+void Keymapper::registerHardwareInputSet(HardwareInputSet *inputs) {
+	if (_hardwareInputs)
+		error("Hardware input set already registered");
 
-	if (!keys) {
-		warning("No hardware keys are supplied");
+	if (!inputs) {
+		warning("No hardware input are supplied");
 		return;
 	}
 
-	_hardwareKeys = keys;
+	_hardwareInputs = inputs;
 }
 
 void Keymapper::addGlobalKeymap(Keymap *keymap) {
@@ -95,15 +95,15 @@ void Keymapper::addGameKeymap(Keymap *keymap) {
 }
 
 void Keymapper::initKeymap(Domain &domain, Keymap *map) {
-	if (!_hardwareKeys) {
-		warning("No hardware keys were registered yet (%s)", map->getName().c_str());
+	if (!_hardwareInputs) {
+		warning("No hardware inputs were registered yet (%s)", map->getName().c_str());
 		return;
 	}
 
 	map->setConfigDomain(domain.getConfigDomain());
-	map->loadMappings(_hardwareKeys);
+	map->loadMappings(_hardwareInputs);
 
-	if (map->isComplete(_hardwareKeys) == false) {
+	if (map->isComplete(_hardwareInputs) == false) {
 		map->saveMappings();
 		ConfMan.flushToDisk();
 	}
@@ -291,8 +291,8 @@ List<Event> Keymapper::executeAction(const Action *action, bool keyDown) {
 	return mappedEvents;
 }
 
-const HardwareKey *Keymapper::findHardwareKey(const KeyState& key) {
-	return (_hardwareKeys) ? _hardwareKeys->findHardwareKey(key) : 0;
+const HardwareInput *Keymapper::findHardwareInput(const KeyState& key) {
+	return (_hardwareInputs) ? _hardwareInputs->findHardwareInput(key) : 0;
 }
 
 } // End of namespace Common
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index 31bfcbc..daa746f 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -31,7 +31,7 @@
 #include "common/list.h"
 #include "common/hashmap.h"
 #include "common/stack.h"
-#include "backends/keymapper/hardware-key.h"
+#include "backends/keymapper/hardware-input.h"
 #include "backends/keymapper/keymap.h"
 
 namespace Common {
@@ -81,17 +81,17 @@ public:
 	virtual List<Event> mapEvent(const Event &ev, EventSource *source);
 
 	/**
-	 * Registers a HardwareKeySet with the Keymapper
+	 * Registers a HardwareInputSet with the Keymapper
 	 * @note should only be called once (during backend initialisation)
 	 */
-	void registerHardwareKeySet(HardwareKeySet *keys);
+	void registerHardwareInputSet(HardwareInputSet *inputs);
 
 	/**
-	 * Get a list of all registered HardwareKeys
+	 * Get a list of all registered HardwareInputs
 	 */
-	const List<const HardwareKey *> &getHardwareKeys() const {
-		assert(_hardwareKeys);
-		return _hardwareKeys->getHardwareKeys();
+	const List<const HardwareInput *> &getHardwareInputs() const {
+		assert(_hardwareInputs);
+		return _hardwareInputs->getHardwareInputs();
 	}
 
 	/**
@@ -168,9 +168,9 @@ public:
 	void setEnabled(bool enabled) { _enabled = enabled; }
 
 	/**
-	 * Return a HardwareKey pointer for the given key state
+	 * Return a HardwareInput pointer for the given key state
 	 */
-	const HardwareKey *findHardwareKey(const KeyState& key);
+	const HardwareInput *findHardwareInput(const KeyState& key);
 
 	Domain& getGlobalDomain() { return _globalDomain; }
 	Domain& getGameDomain() { return _gameDomain; }
@@ -183,7 +183,7 @@ private:
 	Domain _globalDomain;
 	Domain _gameDomain;
 
-	HardwareKeySet *_hardwareKeys;
+	HardwareInputSet *_hardwareInputs;
 
 	void pushKeymap(Keymap *newMap, bool transparent, bool global);
 
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index a869909..dab2952 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -244,7 +244,7 @@ void RemapDialog::clearMapping(uint i) {
 
 	debug(3, "clear the mapping %u", i);
 	_activeRemapAction = _currentActions[_topAction + i].action;
-	_activeRemapAction->mapKey(0);
+	_activeRemapAction->mapInput(0);
 	_activeRemapAction->getParent()->saveMappings();
 	_changes = true;
 
@@ -286,12 +286,12 @@ void RemapDialog::handleKeyDown(Common::KeyState state) {
 
 void RemapDialog::handleKeyUp(Common::KeyState state) {
 	if (_activeRemapAction) {
-		const HardwareKey *hwkey = _keymapper->findHardwareKey(state);
+		const HardwareInput *hwInput = _keymapper->findHardwareInput(state);
 
 		debug(4, "RemapDialog::handleKeyUp Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
 
-		if (hwkey) {
-			_activeRemapAction->mapKey(hwkey);
+		if (hwInput) {
+			_activeRemapAction->mapInput(hwInput);
 			_activeRemapAction->getParent()->saveMappings();
 			_changes = true;
 			stopRemapping();
@@ -325,7 +325,7 @@ void RemapDialog::loadKeymap() {
 		// - all of the topmost keymap action
 		// - all mapped actions that are reachable
 
-		List<const HardwareKey *> freeKeys(_keymapper->getHardwareKeys());
+		List<const HardwareInput *> freeInputs(_keymapper->getHardwareInputs());
 
 		int topIndex = activeKeymaps.size() - 1;
 
@@ -344,8 +344,8 @@ void RemapDialog::loadKeymap() {
 
 			_currentActions.push_back(info);
 
-			if (act->getMappedKey())
-				freeKeys.remove(act->getMappedKey());
+			if (act->getMappedInput())
+				freeInputs.remove(act->getMappedInput());
 		}
 
 		// loop through remaining finding mappings for unmapped keys
@@ -353,21 +353,21 @@ void RemapDialog::loadKeymap() {
 			for (int i = topIndex - 1; i >= 0; --i) {
 				Keymapper::MapRecord mr = activeKeymaps[i];
 				debug(3, "RemapDialog::loadKeymap keymap: %s", mr.keymap->getName().c_str());
-				List<const HardwareKey *>::iterator keyIt = freeKeys.begin();
+				List<const HardwareInput *>::iterator inputIt = freeInputs.begin();
+				while (inputIt != freeInputs.end()) {
 
-				while (keyIt != freeKeys.end()) {
-					Action *act = mr.keymap->getMappedAction((*keyIt)->key);
+					Action *act = mr.keymap->getMappedAction((*inputIt)->key);
 
 					if (act) {
 						ActionInfo info = {act, true, act->description + " (" + mr.keymap->getName() + ")"};
 						_currentActions.push_back(info);
-						freeKeys.erase(keyIt++);
+						freeInputs.erase(inputIt);
 					} else {
-						++keyIt;
+						++inputIt;
 					}
 				}
 
-				if (mr.transparent == false || freeKeys.empty())
+				if (mr.transparent == false || freeInputs.empty())
 					break;
 			}
 		}
@@ -420,10 +420,10 @@ void RemapDialog::refreshKeymap() {
 			widg.actionText->setLabel(info.description);
 			widg.actionText->setEnabled(!info.inherited);
 
-			const HardwareKey *mappedKey = info.action->getMappedKey();
+			const HardwareInput *mappedInput = info.action->getMappedInput();
 
-			if (mappedKey)
-				widg.keyButton->setLabel(mappedKey->description);
+			if (mappedInput)
+				widg.keyButton->setLabel(mappedInput->description);
 			else
 				widg.keyButton->setLabel("-");
 
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp
index a58b93e..21d2344 100644
--- a/backends/platform/android/events.cpp
+++ b/backends/platform/android/events.cpp
@@ -224,12 +224,12 @@ void OSystem_Android::setupKeymapper() {
 
 	Keymapper *mapper = getEventManager()->getKeymapper();
 
-	HardwareKeySet *keySet = new HardwareKeySet();
+	HardwareInputSet *inputSet = new HardwareInputSet();
 
-	keySet->addHardwareKey(
-		new HardwareKey("n", KeyState(KEYCODE_n), "n (vk)"));
+	keySet->addHardwareInput(
+		new HardwareInput("n", KeyState(KEYCODE_n), "n (vk)"));
 
-	mapper->registerHardwareKeySet(keySet);
+	mapper->registerHardwareInputSet(inputSet);
 
 	Keymap *globalMap = new Keymap(kGlobalKeymapName);
 	Action *act;
diff --git a/backends/platform/linuxmoto/hardwarekeys.cpp b/backends/platform/linuxmoto/hardwarekeys.cpp
index da093c6..e1a5757 100644
--- a/backends/platform/linuxmoto/hardwarekeys.cpp
+++ b/backends/platform/linuxmoto/hardwarekeys.cpp
@@ -106,7 +106,7 @@ static const Mod modifiers[] = {
 	{ 0, 0, 0, false }
 };
 
-Common::HardwareKeySet *OSystem_LINUXMOTO::getHardwareKeySet() {
-	return OSystem_SDL::getHardwareKeySet();
+Common::HardwareInputSet *OSystem_LINUXMOTO::getHardwareInputSet() {
+	return OSystem_SDL::getHardwareInputSet();
 }
 #endif
diff --git a/backends/platform/linuxmoto/linuxmoto-sdl.h b/backends/platform/linuxmoto/linuxmoto-sdl.h
index 9a0be56..27f4e74 100644
--- a/backends/platform/linuxmoto/linuxmoto-sdl.h
+++ b/backends/platform/linuxmoto/linuxmoto-sdl.h
@@ -31,7 +31,7 @@ public:
 
 #ifdef ENABLE_KEYMAPPER
 	// FIXME: This just calls parent methods, is it needed?
-	virtual Common::HardwareKeySet *getHardwareKeySet();
+	virtual Common::HardwareInputSet *getHardwareInputSet();
 #endif
 };
 
diff --git a/backends/platform/maemo/maemo-keys.h b/backends/platform/maemo/maemo-keys.h
index e133751..ae3a746 100644
--- a/backends/platform/maemo/maemo-keys.h
+++ b/backends/platform/maemo/maemo-keys.h
@@ -28,7 +28,7 @@
 
 #include "common/keyboard.h"
 
-#include "backends/keymapper/hardware-key.h"
+#include "backends/keymapper/hardware-input.h"
 
 namespace Common {
 
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp
index a127926..53e88d2 100644
--- a/backends/platform/maemo/maemo.cpp
+++ b/backends/platform/maemo/maemo.cpp
@@ -182,8 +182,8 @@ void OSystem_SDL_Maemo::setupIcon() {
 }
 
 #ifdef ENABLE_KEYMAPPER
-Common::HardwareKeySet *OSystem_SDL_Maemo::getHardwareKeySet() {
-	return new Common::HardwareKeySet(Common::maemoKeys, Common::maemoModifiers);
+Common::HardwareInputSet *OSystem_SDL_Maemo::getHardwareInputSet() {
+	return new Common::HardwareInputSet(Common::maemoKeys, Common::maemoModifiers);
 }
 
 Common::Keymap *OSystem_SDL_Maemo::getGlobalKeymap() {
diff --git a/backends/platform/maemo/maemo.h b/backends/platform/maemo/maemo.h
index 4b84ae5..43bc262 100644
--- a/backends/platform/maemo/maemo.h
+++ b/backends/platform/maemo/maemo.h
@@ -42,7 +42,7 @@ public:
 	virtual void setWindowCaption(const char *caption);
 	virtual void setupIcon();
 #ifdef ENABLE_KEYMAPPER
-	virtual Common::HardwareKeySet *getHardwareKeySet();
+	virtual Common::HardwareInputSet *getHardwareInputSet();
 	virtual Common::Keymap *getGlobalKeymap();
 	virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return _keymapperDefaultBindings; }
 #endif
diff --git a/backends/platform/sdl/hardwarekeys.cpp b/backends/platform/sdl/hardwarekeys.cpp
index 5fb4473..0b73bfa 100644
--- a/backends/platform/sdl/hardwarekeys.cpp
+++ b/backends/platform/sdl/hardwarekeys.cpp
@@ -175,7 +175,7 @@ static const ModifierTableEntry sdlModifiers[] = {
 	{ 0, 0, 0, false }
 };
 
-Common::HardwareKeySet *OSystem_SDL::getHardwareKeySet() {
-	return new HardwareKeySet(sdlKeys, sdlModifiers);
+Common::HardwareInputSet *OSystem_SDL::getHardwareInputSet() {
+	return new HardwareInputSet(sdlKeys, sdlModifiers);
 }
 #endif
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 64e63b4..51a7b2f 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -59,7 +59,7 @@ public:
 	virtual void engineDone();
 #endif
 #ifdef ENABLE_KEYMAPPER
-	virtual Common::HardwareKeySet *getHardwareKeySet();
+	virtual Common::HardwareInputSet *getHardwareInputSet();
 #endif
 	virtual void quit();
 	virtual void fatalError();
diff --git a/backends/platform/webos/webos.cpp b/backends/platform/webos/webos.cpp
index 710a3f7..7dd42e5 100644
--- a/backends/platform/webos/webos.cpp
+++ b/backends/platform/webos/webos.cpp
@@ -52,16 +52,16 @@ void OSystem_SDL_WebOS::initBackend() {
  * @return The hardware key set with added webOS specific keys.
  */
 #ifdef ENABLE_KEYMAPPER
-HardwareKeySet *OSystem_SDL_WebOS::getHardwareKeySet() {
+HardwareInputSet *OSystem_SDL_WebOS::getHardwareInputSet() {
 	// Get the original SDL hardware key set
-	HardwareKeySet *keySet = OSystem_SDL::getHardwareKeySet();
+	HardwareInputSet *inputSet = OSystem_SDL::getHardwareInputSet();
 
 	// Add WebOS specific keys
-	keySet->addHardwareKey(new HardwareKey("FORWARD",
+	keySet->addHardwareInput(new HardwareInput("FORWARD",
 		KeyState((KeyCode) 229, 229, 0), "Forward"));
 
 	// Return the modified hardware key set
-	return keySet;
+	return inputSet;
 }
 #endif
 
diff --git a/backends/platform/webos/webos.h b/backends/platform/webos/webos.h
index 71390a1..8dfa432 100644
--- a/backends/platform/webos/webos.h
+++ b/backends/platform/webos/webos.h
@@ -32,7 +32,7 @@ public:
 
 	virtual void initBackend();
 #ifdef ENABLE_KEYMAPPER
-	virtual Common::HardwareKeySet *getHardwareKeySet();
+	virtual Common::HardwareInputSet *getHardwareInputSet();
 #endif
 };
 
diff --git a/base/main.cpp b/base/main.cpp
index 5e9f1d4..391d911 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -264,10 +264,10 @@ static void setupKeymapper(OSystem &system) {
 
 	Keymapper *mapper = system.getEventManager()->getKeymapper();
 
-	HardwareKeySet *keySet = system.getHardwareKeySet();
+	HardwareInputSet *inputSet = system.getHardwareInputSet();
 
 	// Query backend for hardware keys and register them
-	mapper->registerHardwareKeySet(keySet);
+	mapper->registerHardwareInputSet(inputSet);
 
 	// Now create the global keymap
 	Keymap *primaryGlobalKeymap = new Keymap(kGlobalKeymapName);
diff --git a/common/system.h b/common/system.h
index 85a9f6a..dc74533 100644
--- a/common/system.h
+++ b/common/system.h
@@ -52,7 +52,7 @@ class TimerManager;
 class SeekableReadStream;
 class WriteStream;
 #ifdef ENABLE_KEYMAPPER
-class HardwareKeySet;
+class HardwareInputSet;
 class Keymap;
 class KeymapperDefaultBindings;
 #endif
@@ -938,15 +938,15 @@ public:
 
 #ifdef ENABLE_KEYMAPPER
 	/**
-	 * Register hardware keys with keymapper
+	 * Register hardware inputs with keymapper
 	 * IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
 	 * this, please talk to tsoliman and/or LordHoto.
 	 *
-	 * @return HardwareKeySet with all keys and recommended mappings
+	 * @return HardwareInputSet with all keys and recommended mappings
 	 *
 	 * See keymapper documentation for further reference.
 	 */
-	virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
+	virtual Common::HardwareInputSet *getHardwareInputSet() { return 0; }
 
 	/**
 	 * Return a platform-specific global keymap






More information about the Scummvm-git-logs mailing list