src/video/emscripten/SDL_emscriptenevents.c
changeset 12570 bb39a14d510c
parent 12503 806492103856
child 12572 397aa57185c4
     1.1 --- a/src/video/emscripten/SDL_emscriptenevents.c	Mon Jan 21 23:41:43 2019 +0100
     1.2 +++ b/src/video/emscripten/SDL_emscriptenevents.c	Tue Jan 29 12:14:33 2019 +0000
     1.3 @@ -551,6 +551,8 @@
     1.4  Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)
     1.5  {
     1.6      SDL_WindowData *window_data = userData;
     1.7 +    SDL_VideoDisplay *display;
     1.8 +
     1.9      if(fullscreenChangeEvent->isFullscreen)
    1.10      {
    1.11          window_data->window->flags |= window_data->requested_fullscreen_mode;
    1.12 @@ -563,6 +565,13 @@
    1.13      else
    1.14      {
    1.15          window_data->window->flags &= ~FULLSCREEN_MASK;
    1.16 +
    1.17 +        /* reset fullscreen window if the browser left fullscreen */
    1.18 +        display = SDL_GetDisplayForWindow(window_data->window);
    1.19 +
    1.20 +        if (display->fullscreen_window == window_data->window) {
    1.21 +            display->fullscreen_window = NULL;
    1.22 +        }
    1.23      }
    1.24  
    1.25      return 0;