summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2013-06-04 06:36:59 +0000
committermatthijs <matthijs@openttd.org>2013-06-04 06:36:59 +0000
commit0d28dc92fc71c55fe0249937af5e98ebfadb2151 (patch)
tree8b05305a3adc80be5cc137b05981332328e89cd3
parent61f7b504807a3ab89fd2783456c1eaadf21c9da3 (diff)
downloadopenttd-0d28dc92fc71c55fe0249937af5e98ebfadb2151.tar.xz
(svn r25318) -Fix: [SDL, FS#5580] Keyboard input stopped working after fullscreen toggle
-rw-r--r--src/video/sdl_v.cpp11
-rw-r--r--src/video/sdl_v.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index a9b909b82..736e069ce 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -340,6 +340,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
SDL_CALL SDL_QuitSubSystem(SDL_INIT_VIDEO);
SDL_CALL SDL_InitSubSystem(SDL_INIT_VIDEO);
ClaimMousePointer();
+ SetupKeyboard();
}
}
/* Remember if we wanted a hwpalette. We can't reliably query
@@ -649,15 +650,19 @@ const char *VideoDriver_SDL::Start(const char * const *parm)
DEBUG(driver, 1, "SDL: using driver '%s'", buf);
MarkWholeScreenDirty();
-
- SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
- SDL_CALL SDL_EnableUNICODE(1);
+ SetupKeyboard();
_draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL;
return NULL;
}
+void VideoDriver_SDL::SetupKeyboard()
+{
+ SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+ SDL_CALL SDL_EnableUNICODE(1);
+}
+
void VideoDriver_SDL::Stop()
{
SdlClose(SDL_INIT_VIDEO);
diff --git a/src/video/sdl_v.h b/src/video/sdl_v.h
index 6c69d68d8..66f8bf856 100644
--- a/src/video/sdl_v.h
+++ b/src/video/sdl_v.h
@@ -37,6 +37,7 @@ public:
private:
int PollEvent();
bool CreateMainSurface(uint w, uint h);
+ void SetupKeyboard();
};
/** Factory for the SDL video driver. */