Skip to content
Permalink
Browse files

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.
  • Loading branch information
dreamlayers committed Sep 13, 2016
1 parent 3e5c4ce commit a0a75f384f52a10db23402097b1d8d98d2e78cd2
Showing with 4 additions and 4 deletions.
  1. +4 −4 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);

0 comments on commit a0a75f3

Please sign in to comment.