Skip to content

Commit

Permalink
emscripten: Fixed unregistering of key event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
DutChen18 authored and slouken committed Feb 14, 2025
1 parent c16b7bc commit 8a648df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/emscripten/SDL_emscriptenevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,11 +1095,11 @@ void Emscripten_UnregisterEventHandlers(SDL_WindowData *data)
emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL);

target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
if (!target) {
if (!target || !*target) {
target = EMSCRIPTEN_EVENT_TARGET_WINDOW;
}

if (*target) {
if (SDL_strcmp(target, "#none") != 0) {
emscripten_set_keydown_callback(target, NULL, 0, NULL);
emscripten_set_keyup_callback(target, NULL, 0, NULL);
emscripten_set_keypress_callback(target, NULL, 0, NULL);
Expand Down

0 comments on commit 8a648df

Please sign in to comment.