EVENTS: Disable ScummVM's source of keyboard repeat events by default

Backends can still (and do) generate such events. This works around an
issue with the keymapper where the "DOWN" event would be mapped to a
key, but the corresponding "UP" event would be mapped to another one due
to a keymap change. The keyboard repeat generation system would believe
the key to be still pressed and send a continuous stream of repeat
events.
Ideally the keymapper should be fixed to always generate matching event
pairs. However this source of an infinite stream of events still looks
like trouble waiting to happen to me. Hence disabling it by default.
This commit is contained in:
Bastien Bouclet 2020-01-28 18:44:09 +01:00
parent 5106563c65
commit 43184657e9
2 changed files with 4 additions and 4 deletions

View file

@ -207,9 +207,9 @@ void OSystem_SDL::initBackend() {
if (_eventManager == nullptr) {
DefaultEventManager *eventManager = new DefaultEventManager(_eventSource);
#if SDL_VERSION_ATLEAST(2, 0, 0)
// SDL 2 generates its own keyboard repeat events.
eventManager->setGenerateKeyRepeatEvents(false);
#if !SDL_VERSION_ATLEAST(2, 0, 0)
// SDL 1 does not generate its own keyboard repeat events.
eventManager->setGenerateKeyRepeatEvents(true);
#endif
_eventManager = eventManager;
}