Skip to content
Browse files

KEYMAPPER: Create a DefaultEventMapper when Keymapper isn't enabled

This allows migration to unconditional mapping
  • Loading branch information...
1 parent e7ade8a commit 5c3e48fddf2f021d51e41db1672d7ff543c52426 @tsoliman tsoliman committed Feb 17, 2012
Showing with 7 additions and 0 deletions.
  1. +2 −0 backends/events/default/default-events.cpp
  2. +5 −0 common/events.h
View
2 backends/events/default/default-events.cpp
@@ -60,6 +60,8 @@ DefaultEventManager::DefaultEventManager(Common::EventSource *boss) :
// EventDispatcher will automatically free the keymapper
_dispatcher.registerMapper(_keymapper);
_remap = false;
+#else
+ _dispatcher.registerMapper(new Common::DefaultEventMapper());
#endif
}
View
5 common/events.h
@@ -219,6 +219,11 @@ class EventMapper : public EventSource, public EventObserver {
bool allowMapping() const { return false; }
};
+class DefaultEventMapper : public EventMapper, private ArtificialEventSource {
+ bool notifyEvent(const Event &ev) { ArtificialEventSource::addEvent(Event(ev)); return true; }
+ bool pollEvent(Event &ev) { return ArtificialEventSource::pollEvent(ev); }
+};
+
/**
* Dispatches events from various sources to various observers.
*

0 comments on commit 5c3e48f

Please sign in to comment.
Something went wrong with that request. Please try again.