aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorBastien Bouclet2017-11-24 19:37:58 +0100
committerGitHub2017-11-24 19:37:58 +0100
commit5ed745f5329a54d33f1b1551569cf9856990bea1 (patch)
treee444facb6330945c3ee03c6252b386dc8e70acad /backends/platform
parentc5caf9825e0d02036795afa87f49b7aa274cc983 (diff)
parentacf87add2751ae68298f4d5b5480635d06b0ec5e (diff)
downloadscummvm-rg350-5ed745f5329a54d33f1b1551569cf9856990bea1.tar.gz
scummvm-rg350-5ed745f5329a54d33f1b1551569cf9856990bea1.tar.bz2
scummvm-rg350-5ed745f5329a54d33f1b1551569cf9856990bea1.zip
Merge pull request #1063 from bgK/keyboard-repeat
SDL2: Improve handling of keyboard repeat events
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/android/events.cpp2
-rw-r--r--backends/platform/sdl/sdl.cpp11
-rw-r--r--backends/platform/tizen/form.cpp1
3 files changed, 12 insertions, 2 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp
index b146945a01..d13d381f95 100644
--- a/backends/platform/android/events.cpp
+++ b/backends/platform/android/events.cpp
@@ -443,7 +443,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3,
}
if (arg5 > 0)
- e.synthetic = true;
+ e.kbdRepeat = true;
// map special keys to 'our' ascii codes
switch (e.kbd.keycode) {
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;
diff --git a/backends/platform/tizen/form.cpp b/backends/platform/tizen/form.cpp
index 2a9a3967cc..22e15f61c4 100644
--- a/backends/platform/tizen/form.cpp
+++ b/backends/platform/tizen/form.cpp
@@ -243,7 +243,6 @@ void TizenAppForm::pushEvent(Common::EventType type, const Point &currentPositio
void TizenAppForm::pushKey(Common::KeyCode keycode) {
if (_eventQueueLock) {
Common::Event e;
- e.synthetic = false;
e.kbd.keycode = keycode;
e.kbd.ascii = keycode;
e.kbd.flags = 0;