diff options
author | Bastien Bouclet | 2017-09-09 15:45:28 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-11-19 16:12:50 +0100 |
commit | 8fc70ce37fee8880b12d64c420c0c6c296f551d2 (patch) | |
tree | f5e7b50f92abb7931cdada8cfa14d1233dbc840e /backends/platform/sdl | |
parent | 7d811d356e1a85ab39cb010fd90435e73edb9fde (diff) | |
download | scummvm-rg350-8fc70ce37fee8880b12d64c420c0c6c296f551d2.tar.gz scummvm-rg350-8fc70ce37fee8880b12d64c420c0c6c296f551d2.tar.bz2 scummvm-rg350-8fc70ce37fee8880b12d64c420c0c6c296f551d2.zip |
SDL: Improve handling of SDL2 keyboard repeat events
- Flag them as repeat events
- Disable ScummVM's own repeat event generation
This fixes keyboard repeat events not being flagged as such with SDL2,
and complies with the user's operating system preferences regarding key
repeat timings.
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index f2bf9590c5..68a987bc61 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -43,6 +43,7 @@ #include "backends/audiocd/sdl/sdl-audiocd.h" #endif +#include "backends/events/default/default-events.h" #include "backends/events/sdl/sdl-events.h" #include "backends/mutex/sdl/sdl-mutex.h" #include "backends/timer/sdl/sdl-timer.h" @@ -207,6 +208,16 @@ void OSystem_SDL::initBackend() { if (_eventSource == 0) _eventSource = new SdlEventSource(); + 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); +#endif + _eventManager = eventManager; + } + + #ifdef USE_OPENGL #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_DisplayMode displayMode; |