diff options
Diffstat (limited to 'common/EventDispatcher.cpp')
-rw-r--r-- | common/EventDispatcher.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index 4e3f671cfd..4c7286bbb5 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -48,24 +48,16 @@ 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. - if (_mapper && allowMapping) { - if (_mapper->notifyEvent(event)) { - // 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; - } - } + assert(_mapper); + List<Event> mappedEvents = _mapper->mapEvent(event, i->source); - dispatchEvent(event); + for (List<Event>::iterator j = mappedEvents.begin(); j != mappedEvents.end(); ++j) { + const Event mappedEvent = *j; + dispatchEvent(mappedEvent); + } } } } |