aboutsummaryrefslogtreecommitdiff
path: root/backends/keymapper
diff options
context:
space:
mode:
authorTarek Soliman2012-02-17 12:17:51 -0600
committerTarek Soliman2012-02-20 06:49:21 -0600
commite7ade8ae05aff3669059e6003e046d1ef6e914a3 (patch)
treee990dd504d398f6dc83b954f63d7a81c75f24dbf /backends/keymapper
parentae992bebe391ac1d0196e9e32f688b38cb3fd56f (diff)
downloadscummvm-rg350-e7ade8ae05aff3669059e6003e046d1ef6e914a3.tar.gz
scummvm-rg350-e7ade8ae05aff3669059e6003e046d1ef6e914a3.tar.bz2
scummvm-rg350-e7ade8ae05aff3669059e6003e046d1ef6e914a3.zip
KEYMAPPER: EventMapper must now eat all events
Diffstat (limited to 'backends/keymapper')
-rw-r--r--backends/keymapper/keymapper.cpp18
-rw-r--r--backends/keymapper/keymapper.h6
2 files changed, 21 insertions, 3 deletions
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index 1c83bb877e..cda34ff052 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -181,12 +181,24 @@ void Keymapper::popKeymap(const char *name) {
}
bool Keymapper::notifyEvent(const Common::Event &ev) {
+ bool mapped = false;
+
if (ev.type == Common::EVENT_KEYDOWN)
- return mapKeyDown(ev.kbd);
+ mapped = mapKeyDown(ev.kbd);
else if (ev.type == Common::EVENT_KEYUP)
- return mapKeyUp(ev.kbd);
+ mapped = mapKeyUp(ev.kbd);
+
+ if (mapped)
+ return true;
else
- return false;
+ return mapEvent(ev);
+}
+
+bool Keymapper::mapEvent(const Common::Event &ev) {
+ // pass through - copy the event
+ Event evt = ev;
+ addEvent(evt);
+ return true;
}
bool Keymapper::mapKeyDown(const KeyState& key) {
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index 27e981923b..626df013ac 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -164,6 +164,12 @@ public:
bool mapKeyUp(const KeyState& key);
/**
+ * Map non-key incoming events
+ * @param ev incoming event
+ */
+ bool mapEvent(const Common::Event &ev);
+
+ /**
* Enable/disable the keymapper
*/
void setEnabled(bool enabled) { _enabled = enabled; }