diff options
Diffstat (limited to 'common/EventDispatcher.cpp')
-rw-r--r-- | common/EventDispatcher.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index ce1ef0c1c8..4e3f671cfd 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -45,6 +45,8 @@ EventDispatcher::~EventDispatcher() { void EventDispatcher::dispatch() { Event event; + dispatchPoll(); + for (List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) { const bool allowMapping = i->source->allowMapping(); @@ -94,12 +96,13 @@ void EventDispatcher::unregisterSource(EventSource *source) { } } -void EventDispatcher::registerObserver(EventObserver *obs, uint priority, bool autoFree) { +void EventDispatcher::registerObserver(EventObserver *obs, uint priority, bool autoFree, bool notifyPoll) { ObserverEntry newEntry; newEntry.observer = obs; newEntry.priority = priority; newEntry.autoFree = autoFree; + newEntry.poll = notifyPoll; for (List<ObserverEntry>::iterator i = _observers.begin(); i != _observers.end(); ++i) { if (i->priority < priority) { @@ -130,4 +133,12 @@ void EventDispatcher::dispatchEvent(const Event &event) { } } +void EventDispatcher::dispatchPoll() { + for (List<ObserverEntry>::iterator i = _observers.begin(); i != _observers.end(); ++i) { + if (i->poll == true) + if (i->observer->notifyPoll()) + break; + } +} + } // End of namespace Common |