mirror of https://github.com/libsdl-org/SDL.git
emscripten: restore key event prevent default behaviour
This restores the behaviour before 9221548114 where we only preventDefault the event if:
- the key is recognised
- the event is enabled
- the event is not filtered
(ignoring the KEYPRESS special case, which is unchanged)
This commit is contained in:
parent
fd32342ced
commit
6e931bee01
|
|
@ -794,7 +794,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent
|
|||
{
|
||||
const SDL_Keycode keycode = Emscripten_MapKeyCode(keyEvent);
|
||||
SDL_Scancode scancode = Emscripten_MapScanCode(keyEvent->code);
|
||||
SDL_bool prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE;
|
||||
SDL_bool prevent_default = SDL_FALSE;
|
||||
SDL_bool is_nav_key = SDL_FALSE;
|
||||
|
||||
if (scancode == SDL_SCANCODE_UNKNOWN) {
|
||||
|
|
@ -807,7 +807,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent
|
|||
}
|
||||
|
||||
if (scancode != SDL_SCANCODE_UNKNOWN) {
|
||||
SDL_SendKeyboardKeyAndKeycode(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode, keycode);
|
||||
prevent_default = SDL_SendKeyboardKeyAndKeycode(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode, keycode);
|
||||
}
|
||||
|
||||
/* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress
|
||||
|
|
|
|||
Loading…
Reference in New Issue