From 403d26d5203c659819698c49450a7219315cd1f0 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Wed, 21 Jan 2015 17:24:03 +0100 Subject: [PATCH] Process only keys between ASCII 32 and 126 as char events This fixes bug #55 which ensued from special keys processed as char and key events if SDL 1.2 was used. --- src/backends/sdl/input.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backends/sdl/input.c b/src/backends/sdl/input.c index 829c016c..0dbbd061 100644 --- a/src/backends/sdl/input.c +++ b/src/backends/sdl/input.c @@ -401,13 +401,22 @@ IN_Update(void) #if SDL_VERSION_ATLEAST(2, 0, 0) case SDL_TEXTINPUT: - Char_Event(event.text.text[0]); + if ((event.text.text[0] >= SDLK_SPACE) && + (event.text.text[0] < SDLK_DELETE)) + { + Char_Event(event.text.text[0]); + } + break; #endif case SDL_KEYDOWN: #if !SDL_VERSION_ATLEAST(2, 0, 0) - Char_Event(event.key.keysym.unicode); + if ((event.key.keysym.unicode >= SDLK_SPACE) && + (event.key.keysym.unicode < SDLK_DELETE)) + { + Char_Event(event.key.keysym.unicode); + } #endif if ((event.key.keysym.sym >= SDLK_SPACE) &&