src/video/emscripten/SDL_emscriptenevents.c
changeset 9377 4c29dc2baaa8
parent 9352 2cbf791a601c
child 9378 71743b696c06
     1.1 --- a/src/video/emscripten/SDL_emscriptenevents.c	Mon Mar 02 21:36:45 2015 -0500
     1.2 +++ b/src/video/emscripten/SDL_emscriptenevents.c	Fri Mar 06 21:26:37 2015 +0100
     1.3 @@ -621,10 +621,15 @@
     1.4      emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL);
     1.5      emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL);
     1.6  
     1.7 -    emscripten_set_keydown_callback("#window", NULL, 0, NULL);
     1.8 -    emscripten_set_keyup_callback("#window", NULL, 0, NULL);
     1.9 +    const char *target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
    1.10 +    if (!target) {
    1.11 +        target = "#window";
    1.12 +    }
    1.13  
    1.14 -    emscripten_set_keypress_callback("#window", NULL, 0, NULL);
    1.15 +    emscripten_set_keydown_callback(target, NULL, 0, NULL);
    1.16 +    emscripten_set_keyup_callback(target, NULL, 0, NULL);
    1.17 +
    1.18 +    emscripten_set_keypress_callback(target, NULL, 0, NULL);
    1.19  
    1.20      emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL);
    1.21