src/video/android/SDL_androidvideo.c
changeset 11865 af91d564aa40
parent 11811 5d94cb6b24d3
child 12012 6de756c9975a
equal deleted inserted replaced
11864:2eff89e82b60 11865:af91d564aa40
   118 
   118 
   119     device->GetDisplayDPI = Android_GetDisplayDPI;
   119     device->GetDisplayDPI = Android_GetDisplayDPI;
   120 
   120 
   121     device->CreateSDLWindow = Android_CreateWindow;
   121     device->CreateSDLWindow = Android_CreateWindow;
   122     device->SetWindowTitle = Android_SetWindowTitle;
   122     device->SetWindowTitle = Android_SetWindowTitle;
       
   123     device->SetWindowFullscreen = Android_SetWindowFullscreen;
   123     device->DestroyWindow = Android_DestroyWindow;
   124     device->DestroyWindow = Android_DestroyWindow;
   124     device->GetWindowWMInfo = Android_GetWindowWMInfo;
   125     device->GetWindowWMInfo = Android_GetWindowWMInfo;
   125 
   126 
   126     device->free = Android_DeleteDevice;
   127     device->free = Android_DeleteDevice;
   127 
   128 
   218     Android_ScreenRate = rate;
   219     Android_ScreenRate = rate;
   219 
   220 
   220     /*
   221     /*
   221       Update the resolution of the desktop mode, so that the window
   222       Update the resolution of the desktop mode, so that the window
   222       can be properly resized. The screen resolution change can for
   223       can be properly resized. The screen resolution change can for
   223       example happen when the Activity enters or exists immersive mode,
   224       example happen when the Activity enters or exits immersive mode,
   224       which can happen after VideoInit().
   225       which can happen after VideoInit().
   225     */
   226     */
   226     device = SDL_GetVideoDevice();
   227     device = SDL_GetVideoDevice();
   227     if (device && device->num_displays > 0)
   228     if (device && device->num_displays > 0)
   228     {
   229     {
   232         display->desktop_mode.h = Android_ScreenHeight;
   233         display->desktop_mode.h = Android_ScreenHeight;
   233         display->desktop_mode.refresh_rate  = Android_ScreenRate;
   234         display->desktop_mode.refresh_rate  = Android_ScreenRate;
   234     }
   235     }
   235 
   236 
   236     if (Android_Window) {
   237     if (Android_Window) {
   237         SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height);
       
   238 
       
   239         /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event
   238         /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event
   240          * will fall back to the old mode */
   239          * will fall back to the old mode */
   241         display = SDL_GetDisplayForWindow(Android_Window);
   240         display = SDL_GetDisplayForWindow(Android_Window);
   242 
   241 
   243         display->current_mode.format = format;
   242         display->display_modes[0].format = format;
   244         display->current_mode.w = width;
   243         display->display_modes[0].w = width;
   245         display->current_mode.h = height;
   244         display->display_modes[0].h = height;
   246         display->current_mode.refresh_rate = rate;
   245         display->display_modes[0].refresh_rate = rate;
       
   246         display->current_mode = display->display_modes[0];
       
   247 
       
   248         SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height);
   247     }
   249     }
   248 }
   250 }
   249 
   251 
   250 #endif /* SDL_VIDEO_DRIVER_ANDROID */
   252 #endif /* SDL_VIDEO_DRIVER_ANDROID */
   251 
   253