mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-13 13:25:59 +00:00
Added support for inset handling on Android 15
This commit is contained in:
@@ -1077,9 +1077,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeInsetsChanged)(
|
||||
{
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
|
||||
if (Android_Window) {
|
||||
SDL_SetWindowSafeAreaInsets(Android_Window, left, right, top, bottom);
|
||||
}
|
||||
Android_SetWindowSafeAreaInsets(left, right, top, bottom);
|
||||
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
}
|
||||
|
@@ -63,6 +63,10 @@ static int Android_DeviceHeight = 0;
|
||||
static Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_RGB565; // Default SurfaceView format, in case this is queried before being filled
|
||||
float Android_ScreenDensity = 1.0f;
|
||||
static float Android_ScreenRate = 0.0f;
|
||||
int Android_SafeInsetLeft = 0;
|
||||
int Android_SafeInsetRight = 0;
|
||||
int Android_SafeInsetTop = 0;
|
||||
int Android_SafeInsetBottom = 0;
|
||||
static SDL_SystemTheme Android_SystemTheme;
|
||||
|
||||
static bool Android_SuspendScreenSaver(SDL_VideoDevice *_this)
|
||||
@@ -271,6 +275,18 @@ void Android_SendResize(SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
void Android_SetWindowSafeAreaInsets(int left, int right, int top, int bottom)
|
||||
{
|
||||
Android_SafeInsetLeft = left;
|
||||
Android_SafeInsetRight = right;
|
||||
Android_SafeInsetTop = top;
|
||||
Android_SafeInsetBottom = bottom;
|
||||
|
||||
if (Android_Window) {
|
||||
SDL_SetWindowSafeAreaInsets(Android_Window, left, right, top, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
void Android_SetDarkMode(bool enabled)
|
||||
{
|
||||
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
||||
|
@@ -29,6 +29,7 @@
|
||||
extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float density, float rate);
|
||||
extern void Android_SetFormat(int format_wanted, int format_got);
|
||||
extern void Android_SendResize(SDL_Window *window);
|
||||
extern void Android_SetWindowSafeAreaInsets(int left, int right, int top, int bottom);
|
||||
extern void Android_SetDarkMode(bool enabled);
|
||||
|
||||
// Private display data
|
||||
@@ -42,5 +43,9 @@ struct SDL_VideoData
|
||||
extern int Android_SurfaceWidth;
|
||||
extern int Android_SurfaceHeight;
|
||||
extern float Android_ScreenDensity;
|
||||
extern int Android_SafeInsetLeft;
|
||||
extern int Android_SafeInsetRight;
|
||||
extern int Android_SafeInsetTop;
|
||||
extern int Android_SafeInsetBottom;
|
||||
|
||||
#endif // SDL_androidvideo_h_
|
||||
|
@@ -93,6 +93,8 @@ bool Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Proper
|
||||
SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface);
|
||||
#endif
|
||||
|
||||
SDL_SetWindowSafeAreaInsets(window, Android_SafeInsetLeft, Android_SafeInsetRight, Android_SafeInsetTop, Android_SafeInsetBottom);
|
||||
|
||||
window->internal = data;
|
||||
Android_Window = window;
|
||||
|
||||
|
Reference in New Issue
Block a user