diff options
author | Johannes Schickel | 2009-07-25 01:01:05 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-07-25 01:01:05 +0000 |
commit | ef7166740369bab9111289122aac3ef07c48c0bb (patch) | |
tree | 49c7385e3e9703b0831ea77980437aa254ffbe61 /backends/keymapper | |
parent | eeaafdf4ee012df99b5f4d0ea5b394ad81e1e23c (diff) | |
download | scummvm-rg350-ef7166740369bab9111289122aac3ef07c48c0bb.tar.gz scummvm-rg350-ef7166740369bab9111289122aac3ef07c48c0bb.tar.bz2 scummvm-rg350-ef7166740369bab9111289122aac3ef07c48c0bb.zip |
- Adapt DefaultEventManager to use Common::ArtificialEventSource
- Adapt Keymapper to implement EventMapper interface
svn-id: r42727
Diffstat (limited to 'backends/keymapper')
-rw-r--r-- | backends/keymapper/keymapper.cpp | 11 | ||||
-rw-r--r-- | backends/keymapper/keymapper.h | 6 |
2 files changed, 15 insertions, 2 deletions
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp index 7d888828c6..c0c454168c 100644 --- a/backends/keymapper/keymapper.cpp +++ b/backends/keymapper/keymapper.cpp @@ -168,6 +168,15 @@ void Keymapper::popKeymap() { _activeMaps.pop(); } +bool Keymapper::notifyEvent(const Common::Event &ev) { + if (ev.type == Common::EVENT_KEYDOWN) + return mapKeyDown(ev.kbd); + else if (ev.type == Common::EVENT_KEYUP) + return mapKeyUp(ev.kbd); + else + return false; +} + bool Keymapper::mapKeyDown(const KeyState& key) { return mapKey(key, true); } @@ -255,7 +264,7 @@ void Keymapper::executeAction(const Action *action, bool keyDown) { } evt.mouse = _eventMan->getMousePos(); - _eventMan->pushEvent(evt); + addEvent(evt); } } diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h index c82f64b0ed..f492882ca2 100644 --- a/backends/keymapper/keymapper.h +++ b/backends/keymapper/keymapper.h @@ -39,7 +39,7 @@ namespace Common { -class Keymapper { +class Keymapper : public Common::EventMapper, private Common::ArtificialEventSource { public: struct MapRecord { @@ -134,6 +134,10 @@ public: */ void popKeymap(); + // Implementation of the EventMapper interface + bool notifyEvent(const Common::Event &ev); + bool pollEvent(Common::Event &ev) { return Common::ArtificialEventSource::pollEvent(ev); } + /** * @brief Map a key press event. * If the active keymap contains a Action mapped to the given key, then |