diff options
author | Tarek Soliman | 2012-02-17 17:08:58 -0600 |
---|---|---|
committer | Tarek Soliman | 2012-02-20 06:49:22 -0600 |
commit | a0ba4eb569ae9ec0e05a7ba8532ab304e6852f84 (patch) | |
tree | 8512ff77abea1150250712ab1cb1b872c32b2f67 /common/EventDispatcher.cpp | |
parent | c0b04fdcaa0d357a0565a16ea7be74994e55da07 (diff) | |
download | scummvm-rg350-a0ba4eb569ae9ec0e05a7ba8532ab304e6852f84.tar.gz scummvm-rg350-a0ba4eb569ae9ec0e05a7ba8532ab304e6852f84.tar.bz2 scummvm-rg350-a0ba4eb569ae9ec0e05a7ba8532ab304e6852f84.zip |
KEYMAPPER: Rewrite the EventMapper API
Diffstat (limited to 'common/EventDispatcher.cpp')
-rw-r--r-- | common/EventDispatcher.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index 6f36ee5f0f..4c7286bbb5 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -21,7 +21,6 @@ */ #include "common/events.h" -#include "common/textconsole.h" namespace Common { @@ -49,26 +48,15 @@ void EventDispatcher::dispatch() { dispatchPoll(); for (List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) { - const bool allowMapping = i->source->allowMapping(); - while (i->source->pollEvent(event)) { // We only try to process the events via the setup event mapper, when // we have a setup mapper and when the event source allows mapping. assert(_mapper); - if (allowMapping) { - bool mapped = _mapper->notifyEvent(event); - // EventMappers must map all events - if (!mapped) - error("Event [%u] was not mapped by the EventMapper!", event.type); - // We allow the event mapper to create multiple events, when - // eating an event. - while (_mapper->pollEvent(event)) - dispatchEvent(event); - - // Try getting another event from the current EventSource. - continue; - } else { - dispatchEvent(Event(event)); + List<Event> mappedEvents = _mapper->mapEvent(event, i->source); + + for (List<Event>::iterator j = mappedEvents.begin(); j != mappedEvents.end(); ++j) { + const Event mappedEvent = *j; + dispatchEvent(mappedEvent); } } } |