src/video/emscripten/SDL_emscriptenvideo.c
changeset 10334 0494a8336c48
parent 10333 a0495857c42f
child 10335 77b7fccaaa01
     1.1 --- a/src/video/emscripten/SDL_emscriptenvideo.c	Tue Sep 13 00:03:55 2016 -0700
     1.2 +++ b/src/video/emscripten/SDL_emscriptenvideo.c	Tue Sep 13 00:03:56 2016 -0700
     1.3 @@ -296,6 +296,7 @@
     1.4          if(fullscreen) {
     1.5              EmscriptenFullscreenStrategy strategy;
     1.6              SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
     1.7 +            int res;
     1.8  
     1.9              strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
    1.10  
    1.11 @@ -314,10 +315,12 @@
    1.12  
    1.13              data->requested_fullscreen_mode = window->flags & (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
    1.14              data->fullscreen_resize = is_desktop_fullscreen;
    1.15 -            /*unset the fullscreen flags as we're not actually fullscreen yet*/
    1.16 -            window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
    1.17  
    1.18 -            emscripten_request_fullscreen_strategy(NULL, 1, &strategy);
    1.19 +            res = emscripten_request_fullscreen_strategy(NULL, 1, &strategy);
    1.20 +            if(res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
    1.21 +                /* unset flags, fullscreen failed */
    1.22 +                window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
    1.23 +            }
    1.24          }
    1.25          else
    1.26              emscripten_exit_fullscreen();