Emscripten: Use EMSCRIPTEN_EVENT_TARGET_*
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 09003af..5ebd6a9 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -643,34 +643,34 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data)
emscripten_set_mousemove_callback(data->canvas_id, data, 0, Emscripten_HandleMouseMove);
emscripten_set_mousedown_callback(data->canvas_id, data, 0, Emscripten_HandleMouseButton);
- emscripten_set_mouseup_callback("#document", data, 0, Emscripten_HandleMouseButton);
+ emscripten_set_mouseup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandleMouseButton);
emscripten_set_mouseenter_callback(data->canvas_id, data, 0, Emscripten_HandleMouseFocus);
emscripten_set_mouseleave_callback(data->canvas_id, data, 0, Emscripten_HandleMouseFocus);
emscripten_set_wheel_callback(data->canvas_id, data, 0, Emscripten_HandleWheel);
- emscripten_set_focus_callback("#window", data, 0, Emscripten_HandleFocus);
- emscripten_set_blur_callback("#window", data, 0, Emscripten_HandleFocus);
+ emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, data, 0, Emscripten_HandleFocus);
+ emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, data, 0, Emscripten_HandleFocus);
emscripten_set_touchstart_callback(data->canvas_id, data, 0, Emscripten_HandleTouch);
emscripten_set_touchend_callback(data->canvas_id, data, 0, Emscripten_HandleTouch);
emscripten_set_touchmove_callback(data->canvas_id, data, 0, Emscripten_HandleTouch);
emscripten_set_touchcancel_callback(data->canvas_id, data, 0, Emscripten_HandleTouch);
- emscripten_set_pointerlockchange_callback("#document", data, 0, Emscripten_HandlePointerLockChange);
+ emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandlePointerLockChange);
/* Keyboard events are awkward */
keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
- if (!keyElement) keyElement = "#window";
+ if (!keyElement) keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW;
emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey);
emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey);
emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress);
- emscripten_set_fullscreenchange_callback("#document", data, 0, Emscripten_HandleFullscreenChange);
+ emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, data, 0, Emscripten_HandleFullscreenChange);
- emscripten_set_resize_callback("#window", data, 0, Emscripten_HandleResize);
+ emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, data, 0, Emscripten_HandleResize);
emscripten_set_visibilitychange_callback(data, 0, Emscripten_HandleVisibilityChange);
}
@@ -684,35 +684,35 @@ Emscripten_UnregisterEventHandlers(SDL_WindowData *data)
emscripten_set_mousemove_callback(data->canvas_id, NULL, 0, NULL);
emscripten_set_mousedown_callback(data->canvas_id, NULL, 0, NULL);
- emscripten_set_mouseup_callback("#document", NULL, 0, NULL);
+ emscripten_set_mouseup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL);
emscripten_set_mouseenter_callback(data->canvas_id, NULL, 0, NULL);
emscripten_set_mouseleave_callback(data->canvas_id, NULL, 0, NULL);
emscripten_set_wheel_callback(data->canvas_id, NULL, 0, NULL);
- emscripten_set_focus_callback("#window", NULL, 0, NULL);
- emscripten_set_blur_callback("#window", NULL, 0, NULL);
+ emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, NULL);
+ emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, NULL);
emscripten_set_touchstart_callback(data->canvas_id, NULL, 0, NULL);
emscripten_set_touchend_callback(data->canvas_id, NULL, 0, NULL);
emscripten_set_touchmove_callback(data->canvas_id, NULL, 0, NULL);
emscripten_set_touchcancel_callback(data->canvas_id, NULL, 0, NULL);
- emscripten_set_pointerlockchange_callback("#document", NULL, 0, NULL);
+ emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL);
target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
if (!target) {
- target = "#window";
+ target = EMSCRIPTEN_EVENT_TARGET_WINDOW;
}
emscripten_set_keydown_callback(target, NULL, 0, NULL);
emscripten_set_keyup_callback(target, NULL, 0, NULL);
emscripten_set_keypress_callback(target, NULL, 0, NULL);
- emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL);
+ emscripten_set_fullscreenchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL);
- emscripten_set_resize_callback("#window", NULL, 0, NULL);
+ emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, NULL);
emscripten_set_visibilitychange_callback(NULL, 0, NULL);
}