diff options
author | Bastien Bouclet | 2017-09-09 15:47:37 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-11-19 16:12:50 +0100 |
commit | 7d811d356e1a85ab39cb010fd90435e73edb9fde (patch) | |
tree | 15f0d0b80e223d453fdc0a18eea017a5fbb4c33f /backends/events | |
parent | 7539a77eebc3f26fc78c92962d21a11e46e707ea (diff) | |
download | scummvm-rg350-7d811d356e1a85ab39cb010fd90435e73edb9fde.tar.gz scummvm-rg350-7d811d356e1a85ab39cb010fd90435e73edb9fde.tar.bz2 scummvm-rg350-7d811d356e1a85ab39cb010fd90435e73edb9fde.zip |
EVENTS: Allow disabling repeat event generation
Diffstat (limited to 'backends/events')
-rw-r--r-- | backends/events/default/default-events.cpp | 7 | ||||
-rw-r--r-- | backends/events/default/default-events.h | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 40068e7b9e..455fb98495 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -40,7 +40,8 @@ DefaultEventManager::DefaultEventManager(Common::EventSource *boss) : _modifierState(0), _shouldQuit(false), _shouldRTL(false), - _confirmExitDialogActive(false) { + _confirmExitDialogActive(false), + _shouldGenerateKeyRepeatEvents(true) { assert(boss); @@ -84,7 +85,9 @@ void DefaultEventManager::init() { bool DefaultEventManager::pollEvent(Common::Event &event) { _dispatcher.dispatch(); - handleKeyRepeat(); + if (_shouldGenerateKeyRepeatEvents) { + handleKeyRepeat(); + } if (_eventQueue.empty()) { return false; diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h index 67c7f7708e..df6ebd2f14 100644 --- a/backends/events/default/default-events.h +++ b/backends/events/default/default-events.h @@ -67,6 +67,7 @@ class DefaultEventManager : public Common::EventManager, Common::EventObserver { kKeyRepeatSustainDelay = 100 }; + bool _shouldGenerateKeyRepeatEvents; Common::KeyState _currentKeyDown; uint32 _keyRepeatTime; @@ -95,6 +96,17 @@ public: // this, please talk to tsoliman and/or LordHoto. virtual Common::Keymapper *getKeymapper() { return _keymapper; } #endif + + /** + * Controls whether repeated key down events are generated while a key is pressed + * + * Backends that generate their own keyboard repeat events should disable this. + * + * @param generateKeyRepeatEvents + */ + void setGenerateKeyRepeatEvents(bool generateKeyRepeatEvents) { + _shouldGenerateKeyRepeatEvents = generateKeyRepeatEvents; + } }; #endif |