mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
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.
This commit is contained in:
parent
7d811d356e
commit
8fc70ce37f
@ -696,6 +696,10 @@ bool SdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
|
||||
event.kbd.keycode = SDLToOSystemKeycode(sdlKeycode);
|
||||
event.kbd.ascii = mapKey(sdlKeycode, (SDLMod)ev.key.keysym.mod, obtainUnicode(ev.key.keysym));
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
event.kbdRepeat = ev.key.repeat;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user