Track android device panel width & height as well as window surface & height.

Expand SDLActivity::SDLSurface::surfaceChanged() callback to grab the panel width and height at the same time and pass that along to the native code. Only works on API 17+. Duplicates surface dimensions whenever it fails.

Add Android_DeviceWidth/Android_DeviceHeight globals to native code.
Disambiguate Android_ScreenWidth/Android_ScreenHeight -> Android_SurfaceWidth/Android_SurfaceHeight
Use device width/height for all display mode settings.
This commit is contained in:
Sam Lantinga
2018-06-07 17:07:03 -07:00
parent db86e7a633
commit fe196db774
5 changed files with 46 additions and 23 deletions

View File

@@ -49,8 +49,8 @@ Android_CreateWindow(_THIS, SDL_Window * window)
/* Adjust the window data to match the screen */
window->x = 0;
window->y = 0;
window->w = Android_ScreenWidth;
window->h = Android_ScreenHeight;
window->w = Android_SurfaceWidth;
window->h = Android_SurfaceHeight;
window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */
window->flags &= ~SDL_WINDOW_HIDDEN;