From d83473841bea4597658c1a4fd9b3fbc72e7fa13a Mon Sep 17 00:00:00 2001 From: andzdroid Date: Sat, 21 Nov 2026 20:46:44 +0000 Subject: [PATCH] Filter emscripten key presses --- src/platforms/rcore_web_emscripten.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platforms/rcore_web_emscripten.c b/src/platforms/rcore_web_emscripten.c index 48492cfd4420..423d4fb45b96 100644 --- a/src/platforms/rcore_web_emscripten.c +++ b/src/platforms/rcore_web_emscripten.c @@ -1568,8 +1568,11 @@ static EM_BOOL EmscriptenKeyboardCallback(int eventType, const EmscriptenKeyboar } break; case EMSCRIPTEN_EVENT_KEYPRESS: { + unsigned int codepoint = keyboardEvent->charCode; + if ((codepoint < 32) || ((codepoint > 126) && (codepoint < 160))) break; + // Check if there is space available in the queue for characters to be added - if ((keyboardEvent->charCode > 0) && (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)) + if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE) { CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = keyboardEvent->charCode; CORE.Input.Keyboard.charPressedQueueCount++;