diff options
author | Thierry Crozat | 2017-07-25 09:33:32 +0100 |
---|---|---|
committer | Thierry Crozat | 2017-07-26 21:39:31 +0100 |
commit | b8142ff362668bdf3880a0de2e1531a292cbc785 (patch) | |
tree | 81951e8e1495c20347476c1fa9ed9196dae5abaf /common | |
parent | 4c27396aaae3ee31849a2934ca932149414f1290 (diff) | |
download | scummvm-rg350-b8142ff362668bdf3880a0de2e1531a292cbc785.tar.gz scummvm-rg350-b8142ff362668bdf3880a0de2e1531a292cbc785.tar.bz2 scummvm-rg350-b8142ff362668bdf3880a0de2e1531a292cbc785.zip |
COMMON: Add method in EventManager to clear the event queue
Diffstat (limited to 'common')
-rw-r--r-- | common/EventDispatcher.cpp | 11 | ||||
-rw-r--r-- | common/events.h | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index 2650d795b7..b81db6ff19 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -70,6 +70,17 @@ void EventDispatcher::dispatch() { } } +void EventDispatcher::clearEvents() { + Event event; + + for (List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) { + while (i->source->pollEvent(event)) {} + } + + List<Event> delayedEvents = _mapper->getDelayedEvents(); +} + + void EventDispatcher::registerMapper(EventMapper *mapper, bool autoFree) { if (_autoFreeMapper) { delete _mapper; diff --git a/common/events.h b/common/events.h index 484564e3db..21a65a642b 100644 --- a/common/events.h +++ b/common/events.h @@ -282,6 +282,12 @@ public: void dispatch(); /** + * Clear all events currently in the event queue. + * The cleared events are not dispatched and are simply discarded. + */ + void clearEvents(); + + /** * Registers an event mapper with the dispatcher. * * The ownership of the "mapper" variable will pass |