Skip to content

Commit

Permalink
emscripten: support KaiOS's Left Soft Key and Right Soft Key (thanks,…
Browse files Browse the repository at this point in the history
… pelya!).

Fixes Bugzilla #5027.
  • Loading branch information
icculus committed Apr 7, 2020
1 parent 309d613 commit 8641f6e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/video/emscripten/SDL_emscriptenevents.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 8641f6e

Please sign in to comment.