[Scummvm-cvs-logs] SF.net SVN: scummvm:[42720] scummvm/trunk/common
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Jul 25 02:59:30 CEST 2009
Revision: 42720
http://scummvm.svn.sourceforge.net/scummvm/?rev=42720&view=rev
Author: lordhoto
Date: 2009-07-25 00:59:30 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Add function "allowMapping" to EventSource, for testing whether the event source allows mapping (via the Keymapper for example.)
Modified Paths:
--------------
scummvm/trunk/common/events.cpp
scummvm/trunk/common/events.h
Modified: scummvm/trunk/common/events.cpp
===================================================================
--- scummvm/trunk/common/events.cpp 2009-07-25 00:59:18 UTC (rev 42719)
+++ scummvm/trunk/common/events.cpp 2009-07-25 00:59:30 UTC (rev 42720)
@@ -51,8 +51,12 @@
Common::Event event;
for (Common::List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) {
+ const bool allowMapping = i->source->allowMapping();
+
while (i->source->pollEvent(event)) {
- if (_mapper) {
+ // We only try to process the events via the setup event mapper, when
+ // we have a setup mapper and when the event source allows mapping.
+ if (_mapper && allowMapping) {
if (_mapper->notifyEvent(event)) {
// We allow the event mapper to create multiple events, when
// eating an event.
Modified: scummvm/trunk/common/events.h
===================================================================
--- scummvm/trunk/common/events.h 2009-07-25 00:59:18 UTC (rev 42719)
+++ scummvm/trunk/common/events.h 2009-07-25 00:59:30 UTC (rev 42720)
@@ -146,6 +146,16 @@
* @return true if an event was polled, false otherwise.
*/
virtual bool pollEvent(Event &event) = 0;
+
+ /**
+ * Checks whether events from this source are allowed to be mapped.
+ *
+ * Possible event sources not allowing mapping are: the event recorder/player and/or
+ * the EventManager, which allows user events to be pushed.
+ *
+ * By default we allow mapping for every event source.
+ */
+ virtual bool allowMapping() const { return true; }
};
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list