emscripten: Attach the blur event to window, not document

Fixes blur event handling in Blink.
This commit is contained in:
Sebastian Krzyszkowiak 2020-05-11 16:53:04 +02:00
parent 7f8e3b9641
commit 80044b91e3
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -513,7 +513,7 @@ SYMBOL_EXPORT int libsuperderpy_run(struct Game* game) {
return ret; return ret;
} }
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, game, false, libsuperderpy_emscripten_focus_change); emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, game, false, libsuperderpy_emscripten_focus_change);
if (game->config.autopause && !EM_ASM_INT({document.hasFocus()})) { if (game->config.autopause && !EM_ASM_INT({document.hasFocus()})) {
PrintConsole(game, "Window not focused, autopausing..."); PrintConsole(game, "Window not focused, autopausing...");
PauseExecution(game); PauseExecution(game);