Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unpress all keys on blur to avoid stuck keys
  • Loading branch information
dreamlayers committed Sep 13, 2016
1 parent a0a75f3 commit b54eb82
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/emscripten/SDL_emscriptenevents.c
Expand Up @@ -392,6 +392,11 @@ EM_BOOL
Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData)
{
SDL_WindowData *window_data = userData;
/* If the user switches away while keys are pressed (such as
* via Alt+Tab), key release events won't be received. */
if (eventType == EMSCRIPTEN_EVENT_BLUR) {
SDL_ResetKeyboard();
}
SDL_SendWindowEvent(window_data->window, eventType == EMSCRIPTEN_EVENT_FOCUS ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
return 1;
}
Expand Down

0 comments on commit b54eb82

Please sign in to comment.