emscripten: support KaiOS's Left Soft Key and Right Soft Key (thanks, pelya!).
authorRyan C. Gordon
Tue, 07 Apr 2020 14:03:13 -0400
changeset 1370425edf3df6e51
parent 13703 19c4516de68d
child 13705 6d22d6ce725c
emscripten: support KaiOS's Left Soft Key and Right Soft Key (thanks, pelya!).

Fixes Bugzilla #5027.
src/video/emscripten/SDL_emscriptenevents.c
     1.1 --- a/src/video/emscripten/SDL_emscriptenevents.c	Tue Apr 07 14:01:25 2020 -0400
     1.2 +++ b/src/video/emscripten/SDL_emscriptenevents.c	Tue Apr 07 14:03:13 2020 -0400
     1.3 @@ -485,6 +485,16 @@
     1.4      if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) {
     1.5          scancode = emscripten_scancode_table[keyEvent->keyCode];
     1.6  
     1.7 +        if (keyEvent->keyCode == 0) {
     1.8 +            /* KaiOS Left Soft Key and Right Soft Key, they act as OK/Next/Menu and Cancel/Back/Clear */
     1.9 +            if (SDL_strncmp(keyEvent->key, "SoftLeft", 9) == 0) {
    1.10 +                scancode = SDL_SCANCODE_AC_FORWARD;
    1.11 +            }
    1.12 +            if (SDL_strncmp(keyEvent->key, "SoftRight", 10) == 0) {
    1.13 +                scancode = SDL_SCANCODE_AC_BACK;
    1.14 +            }
    1.15 +        }
    1.16 +
    1.17          if (scancode != SDL_SCANCODE_UNKNOWN) {
    1.18  
    1.19              if (keyEvent->location == DOM_KEY_LOCATION_RIGHT) {