Listen for blur and focus events on window instead of canvas Blur and focus events were not arriving for the canvas in Firefox 35 and Chrome 40.
diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 4bb0efb..e905a53 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -586,8 +586,8 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data)
emscripten_set_wheel_callback("#canvas", data, 0, Emscripten_HandleWheel);
- emscripten_set_focus_callback("#canvas", data, 0, Emscripten_HandleFocus);
- emscripten_set_blur_callback("#canvas", data, 0, Emscripten_HandleFocus);
+ emscripten_set_focus_callback("#window", data, 0, Emscripten_HandleFocus);
+ emscripten_set_blur_callback("#window", data, 0, Emscripten_HandleFocus);
emscripten_set_touchstart_callback("#canvas", data, 0, Emscripten_HandleTouch);
emscripten_set_touchend_callback("#canvas", data, 0, Emscripten_HandleTouch);
@@ -623,8 +623,8 @@ Emscripten_UnregisterEventHandlers(SDL_WindowData *data)
emscripten_set_wheel_callback("#canvas", NULL, 0, NULL);
- emscripten_set_focus_callback("#canvas", NULL, 0, NULL);
- emscripten_set_blur_callback("#canvas", NULL, 0, NULL);
+ emscripten_set_focus_callback("#window", NULL, 0, NULL);
+ emscripten_set_blur_callback("#window", NULL, 0, NULL);
emscripten_set_touchstart_callback("#canvas", NULL, 0, NULL);
emscripten_set_touchend_callback("#canvas", NULL, 0, NULL);