mirror of https://github.com/libsdl-org/SDL.git
emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "#none"
This is used to say "don't even try to listen for keypresses," for apps that are managing this outside of SDL. Fixes #10292.
This commit is contained in:
parent
c603a9c94a
commit
923123a527
|
|
@ -730,7 +730,7 @@ extern "C" {
|
|||
* - "#document": the javascript document object
|
||||
* - "#screen": the javascript window.screen object
|
||||
* - "#canvas": the WebGL canvas element
|
||||
* - "": Don't bind anything at all
|
||||
* - "#none": Don't bind anything at all
|
||||
* - any other string without a leading # sign applies to the element on the
|
||||
* page with that ID.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1029,11 +1029,11 @@ void Emscripten_RegisterEventHandlers(SDL_WindowData *data)
|
|||
|
||||
// Keyboard events are awkward
|
||||
keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
|
||||
if (!keyElement) {
|
||||
if (!keyElement || !*keyElement) {
|
||||
keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW;
|
||||
}
|
||||
|
||||
if (*keyElement) {
|
||||
if (SDL_strcmp(keyElement, "#none") != 0) {
|
||||
emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey);
|
||||
emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey);
|
||||
emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress);
|
||||
|
|
|
|||
Loading…
Reference in New Issue