src/video/emscripten/SDL_emscriptenevents.c
changeset 12570 bb39a14d510c
parent 12503 806492103856
child 12572 397aa57185c4
equal deleted inserted replaced
12569:05aff4771d9a 12570:bb39a14d510c
   549 
   549 
   550 static EM_BOOL
   550 static EM_BOOL
   551 Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)
   551 Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)
   552 {
   552 {
   553     SDL_WindowData *window_data = userData;
   553     SDL_WindowData *window_data = userData;
       
   554     SDL_VideoDisplay *display;
       
   555 
   554     if(fullscreenChangeEvent->isFullscreen)
   556     if(fullscreenChangeEvent->isFullscreen)
   555     {
   557     {
   556         window_data->window->flags |= window_data->requested_fullscreen_mode;
   558         window_data->window->flags |= window_data->requested_fullscreen_mode;
   557 
   559 
   558         window_data->requested_fullscreen_mode = 0;
   560         window_data->requested_fullscreen_mode = 0;
   561             window_data->window->flags |= SDL_WINDOW_FULLSCREEN; /*we didn't reqest fullscreen*/
   563             window_data->window->flags |= SDL_WINDOW_FULLSCREEN; /*we didn't reqest fullscreen*/
   562     }
   564     }
   563     else
   565     else
   564     {
   566     {
   565         window_data->window->flags &= ~FULLSCREEN_MASK;
   567         window_data->window->flags &= ~FULLSCREEN_MASK;
       
   568 
       
   569         /* reset fullscreen window if the browser left fullscreen */
       
   570         display = SDL_GetDisplayForWindow(window_data->window);
       
   571 
       
   572         if (display->fullscreen_window == window_data->window) {
       
   573             display->fullscreen_window = NULL;
       
   574         }
   566     }
   575     }
   567 
   576 
   568     return 0;
   577     return 0;
   569 }
   578 }
   570 
   579