mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
Add function "allowMapping" to EventSource, for testing whether the event source allows mapping (via the Keymapper for example.)
svn-id: r42720
This commit is contained in:
parent
7905bbbc5b
commit
b4a1bceeac
@ -51,8 +51,12 @@ void EventDispatcher::dispatch() {
|
||||
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.
|
||||
|
@ -146,6 +146,16 @@ public:
|
||||
* @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; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user