mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-12-02 16:23:28 +08:00
emscripten: Don't prevent default on filtered key events
This commit is contained in:
parent
afb0606f5a
commit
9de97e19cc
@ -493,7 +493,7 @@ static EM_BOOL
|
||||
Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
|
||||
{
|
||||
Uint32 scancode;
|
||||
SDL_bool prevent_default;
|
||||
SDL_bool prevent_default = SDL_FALSE;
|
||||
SDL_bool is_nav_key;
|
||||
|
||||
/* .keyCode is deprecated, but still the most reliable way to get keys */
|
||||
@ -577,12 +577,10 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi
|
||||
break;
|
||||
}
|
||||
}
|
||||
SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode);
|
||||
prevent_default = SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
|
||||
prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE;
|
||||
|
||||
/* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress
|
||||
* we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user