aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2014-03-12 11:13:48 +0200
committerJukka Jylänki <jujjyl@gmail.com>2014-03-12 11:15:08 +0200
commit74a3d9f57867891282f037ed1ed4d6a7292aa473 (patch)
tree78ad047f4d8a4e01e42e604f39633b04f77edca9
parent7dfd4a4b22668a652c2276d56ff69fee8d7fd20f (diff)
Register mouse callbacks in test_html5_fullscreen.c sample so that it can be tested on IE as well.
-rw-r--r--tests/test_html5_fullscreen.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_html5_fullscreen.c b/tests/test_html5_fullscreen.c
index f1224dce..54b834bd 100644
--- a/tests/test_html5_fullscreen.c
+++ b/tests/test_html5_fullscreen.c
@@ -90,6 +90,11 @@ EM_BOOL fullscreenchange_callback(int eventType, const EmscriptenFullscreenChang
return 0;
}
+EM_BOOL mouse_callback(int eventType, const EmscriptenMouseEvent *e, void *userData)
+{
+ return 0;
+}
+
int main()
{
EMSCRIPTEN_RESULT ret = emscripten_set_keypress_callback(0, 0, 1, key_callback);
@@ -98,7 +103,21 @@ int main()
ret = emscripten_set_fullscreenchange_callback(0, 0, 1, fullscreenchange_callback);
TEST_RESULT(emscripten_set_fullscreenchange_callback);
+ // For Internet Explorer, fullscreen and pointer lock requests cannot be run
+ // from inside keyboard event handlers. Therefore we must register a callback to
+ // mouse events (any other than mousedown) to activate deferred fullscreen/pointerlock
+ // requests to occur for IE. The callback itself can be a no-op.
+ ret = emscripten_set_click_callback(0, 0, 1, mouse_callback);
+ TEST_RESULT(emscripten_set_click_callback);
+ ret = emscripten_set_mousedown_callback(0, 0, 1, mouse_callback);
+ TEST_RESULT(emscripten_set_mousedown_callback);
+ ret = emscripten_set_mouseup_callback(0, 0, 1, mouse_callback);
+ TEST_RESULT(emscripten_set_mouseup_callback);
+ ret = emscripten_set_dblclick_callback(0, 0, 1, mouse_callback);
+ TEST_RESULT(emscripten_set_dblclick_callback);
+
printf("To finish this test, press f to enter fullscreen mode, and then exit it.\n");
+ printf("On IE, press a mouse key over the canvas after pressing f to activate the fullscreen request event.\n");
/* For the events to function, one must either call emscripten_set_main_loop or enable Module.noExitRuntime by some other means.
Otherwise the application will exit after leaving main(), and the atexit handlers will clean up all event hooks (by design). */