From 23a0f5318c50cdf3dce19e4de0c98fb5ae1c2618 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 7 Aug 2011 11:39:54 +0200 Subject: JANITORIAL: Remove trailing empty lines. --- common/EventDispatcher.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'common/EventDispatcher.cpp') diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index e97068c0d0..d3177182ac 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -131,4 +131,3 @@ void EventDispatcher::dispatchEvent(const Event &event) { } } // End of namespace Common - -- cgit v1.2.3 From 84220d2ca05707f22a0242b1745caf0b657237a3 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sat, 6 Aug 2011 09:47:19 +0200 Subject: COMMON: Remove superfluous Common:: qualifiers. --- common/EventDispatcher.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'common/EventDispatcher.cpp') diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index d3177182ac..ce1ef0c1c8 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -28,12 +28,12 @@ EventDispatcher::EventDispatcher() : _mapper(0) { } EventDispatcher::~EventDispatcher() { - for (Common::List::iterator i = _sources.begin(); i != _sources.end(); ++i) { + for (List::iterator i = _sources.begin(); i != _sources.end(); ++i) { if (i->autoFree) delete i->source; } - for (Common::List::iterator i = _observers.begin(); i != _observers.end(); ++i) { + for (List::iterator i = _observers.begin(); i != _observers.end(); ++i) { if (i->autoFree) delete i->observer; } @@ -43,9 +43,9 @@ EventDispatcher::~EventDispatcher() { } void EventDispatcher::dispatch() { - Common::Event event; + Event event; - for (Common::List::iterator i = _sources.begin(); i != _sources.end(); ++i) { + for (List::iterator i = _sources.begin(); i != _sources.end(); ++i) { const bool allowMapping = i->source->allowMapping(); while (i->source->pollEvent(event)) { @@ -83,7 +83,7 @@ void EventDispatcher::registerSource(EventSource *source, bool autoFree) { } void EventDispatcher::unregisterSource(EventSource *source) { - for (Common::List::iterator i = _sources.begin(); i != _sources.end(); ++i) { + for (List::iterator i = _sources.begin(); i != _sources.end(); ++i) { if (i->source == source) { if (i->autoFree) delete source; @@ -101,7 +101,7 @@ void EventDispatcher::registerObserver(EventObserver *obs, uint priority, bool a newEntry.priority = priority; newEntry.autoFree = autoFree; - for (Common::List::iterator i = _observers.begin(); i != _observers.end(); ++i) { + for (List::iterator i = _observers.begin(); i != _observers.end(); ++i) { if (i->priority < priority) { _observers.insert(i, newEntry); return; @@ -112,7 +112,7 @@ void EventDispatcher::registerObserver(EventObserver *obs, uint priority, bool a } void EventDispatcher::unregisterObserver(EventObserver *obs) { - for (Common::List::iterator i = _observers.begin(); i != _observers.end(); ++i) { + for (List::iterator i = _observers.begin(); i != _observers.end(); ++i) { if (i->observer == obs) { if (i->autoFree) delete obs; @@ -124,7 +124,7 @@ void EventDispatcher::unregisterObserver(EventObserver *obs) { } void EventDispatcher::dispatchEvent(const Event &event) { - for (Common::List::iterator i = _observers.begin(); i != _observers.end(); ++i) { + for (List::iterator i = _observers.begin(); i != _observers.end(); ++i) { if (i->observer->notifyEvent(event)) break; } -- cgit v1.2.3 From a4029a8e94a3dbbe03c0aa4571215e9a5b00058d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 8 Aug 2011 15:38:27 +0100 Subject: RECORDER: Restore event recorder functionality. It was badly broken after refactoring into EventObserver. Fitst, deinit() method was never called which lead to bad record files. Then, the concept of counting pollEvent() calls was ignored. Introduced dispatchPoll() method of EventObserver which is implemented in EventRecorder. It counts calls so is able to inject events at more proper time. Additionally now event times are recorded. --- common/EventDispatcher.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'common/EventDispatcher.cpp') 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::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::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::iterator i = _observers.begin(); i != _observers.end(); ++i) { + if (i->poll == true) + if (i->observer->notifyPoll()) + break; + } +} + } // End of namespace Common -- cgit v1.2.3