From 8a1ad4a2de8cddebcd470c68000c5fe409ff9834 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 2 Apr 2024 03:48:03 +0200 Subject: [PATCH] limit to ASCII also forgor to add stuff to h --- src/i_video.h | 2 ++ src/sdl/i_video.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/i_video.h b/src/i_video.h index 602522871..830583822 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -137,4 +137,6 @@ void I_EndRead(void); UINT32 I_GetRefreshRate(void); +boolean I_UseNativeKeyboard(void); + #endif diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 62f7bfe46..f5e84cc88 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -413,11 +413,14 @@ static INT32 GetTypedChar(SDL_Scancode code, SDL_Keysym *sym) if (SDL_PollEvent(&next_event) && next_event.type == SDL_TEXTINPUT) { - if (strlen(next_event.text.text) == 1) - return next_event.text.text[0]; + if (next_event.text.text[1] == '\0') // limit to ASCII + { + if (strlen(next_event.text.text) == 1) + return next_event.text.text[0]; + } } - return Impl_SDL_Scancode_To_Keycode(code); + return Impl_SDL_Scancode_To_Keycode(code); //fallback } static INT32 Impl_SDL_Keysym_To_Keycode(SDL_Keysym keysym)