From 8641f6e99d54e10291c4c73aa25ec8e932c50cdb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 7 Apr 2020 14:03:13 -0400 Subject: [PATCH] emscripten: support KaiOS's Left Soft Key and Right Soft Key (thanks, pelya!). Fixes Bugzilla #5027. --- src/video/emscripten/SDL_emscriptenevents.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 14ebc1763..04fcd275e 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -485,6 +485,16 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) { scancode = emscripten_scancode_table[keyEvent->keyCode]; + if (keyEvent->keyCode == 0) { + /* KaiOS Left Soft Key and Right Soft Key, they act as OK/Next/Menu and Cancel/Back/Clear */ + if (SDL_strncmp(keyEvent->key, "SoftLeft", 9) == 0) { + scancode = SDL_SCANCODE_AC_FORWARD; + } + if (SDL_strncmp(keyEvent->key, "SoftRight", 10) == 0) { + scancode = SDL_SCANCODE_AC_BACK; + } + } + if (scancode != SDL_SCANCODE_UNKNOWN) { if (keyEvent->location == DOM_KEY_LOCATION_RIGHT) {