aboutsummaryrefslogtreecommitdiff
path: root/backends/events
diff options
context:
space:
mode:
authorJohannes Schickel2009-07-25 01:00:37 +0000
committerJohannes Schickel2009-07-25 01:00:37 +0000
commit141ded3063adaee202e4a87ce987d35fba041faf (patch)
tree9bb68e06cdfa933dd64fcd826fe8d47aedf7e27c /backends/events
parent38309da52193ffb3a2a497b4474667a347b0a5c8 (diff)
downloadscummvm-rg350-141ded3063adaee202e4a87ce987d35fba041faf.tar.gz
scummvm-rg350-141ded3063adaee202e4a87ce987d35fba041faf.tar.bz2
scummvm-rg350-141ded3063adaee202e4a87ce987d35fba041faf.zip
Change DefaultEventManager to use EventDispatcher.
svn-id: r42725
Diffstat (limited to 'backends/events')
-rw-r--r--backends/events/default/default-events.cpp16
-rw-r--r--backends/events/default/default-events.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 12bb766cd6..cffc210aaf 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -93,14 +93,18 @@ void writeRecord(Common::OutSaveFile *outFile, uint32 diff, Common::Event &event
}
DefaultEventManager::DefaultEventManager(Common::EventSource *boss) :
- _boss(boss),
_buttonState(0),
_modifierState(0),
_shouldQuit(false),
_shouldRTL(false),
_confirmExitDialogActive(false) {
- assert(_boss);
+ assert(boss);
+
+ g_eventDispatcher.registerSource(boss, false);
+ g_eventDispatcher.registerSource(&_artificialEventSource, false);
+
+ g_eventDispatcher.registerObserver(this, 0, false);
_recordFile = NULL;
_recordTimeFile = NULL;
@@ -378,12 +382,12 @@ void DefaultEventManager::processMillis(uint32 &millis) {
bool DefaultEventManager::pollEvent(Common::Event &event) {
uint32 time = g_system->getMillis();
- bool result;
+ bool result = false;
- if (_artificialEventSource.pollEvent(event)) {
+ g_eventDispatcher.dispatch();
+ if (!_eventQueue.empty()) {
+ event = _eventQueue.pop();
result = true;
- } else {
- result = _boss->pollEvent(event);
#ifdef ENABLE_KEYMAPPER
if (result) {
diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h
index e4c33bc554..b8f47385a8 100644
--- a/backends/events/default/default-events.h
+++ b/backends/events/default/default-events.h
@@ -42,8 +42,6 @@ namespace Common {
class DefaultEventManager : public Common::EventManager, Common::EventObserver {
- Common::EventSource *_boss;
-
#ifdef ENABLE_VKEYBD
Common::VirtualKeyboard *_vk;
#endif