Skip to content

Commit

Permalink
make interactive.test_sdl_wm_togglefullscreen behavior match what the…
Browse files Browse the repository at this point in the history
… text says, keep the canvas painting yellow after leaving fullscreen
  • Loading branch information
kripken committed Feb 24, 2016
1 parent 59b3989 commit 445f12c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/sdl_wm_togglefullscreen.c
Expand Up @@ -12,6 +12,8 @@ int inFullscreen = 0;

int wasFullscreen = 0;

int finished = 0;

void render() {
int width, height, isfs;
emscripten_get_canvas_size(&width, &height, &isfs);
Expand All @@ -21,6 +23,9 @@ void render() {

void mainloop() {
render();

if (finished) return;

SDL_Event event;
int isInFullscreen = EM_ASM_INT_V(return !!(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement));
if (isInFullscreen && !wasFullscreen) {
Expand All @@ -35,7 +40,7 @@ void mainloop() {
REPORT_RESULT();
#endif
wasFullscreen = isInFullscreen;
emscripten_cancel_main_loop();
finished = 1;
return;
}

Expand All @@ -55,7 +60,7 @@ void mainloop() {
#ifdef REPORT_RESULT
REPORT_RESULT();
#endif
emscripten_cancel_main_loop();
finished = 1;
return;
} else {
printf("Entering fullscreen...\n");
Expand Down

0 comments on commit 445f12c

Please sign in to comment.