From e7ade8ae05aff3669059e6003e046d1ef6e914a3 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Fri, 17 Feb 2012 12:17:51 -0600 Subject: KEYMAPPER: EventMapper must now eat all events --- backends/keymapper/keymapper.cpp | 18 +++++++++++++++--- backends/keymapper/keymapper.h | 6 ++++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'backends/keymapper') 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 @@ -163,6 +163,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 */ -- cgit v1.2.3