From 1621378ba1774e37e605109a4c74471e4c785261 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 4 Oct 2025 15:25:07 +0900 Subject: [PATCH 1/2] Android: Create window with SDL_WINDOW_RESIZABLE This reverts commit b7ab1ed476a62c36f21eac8d412db213a0f1ae8a ("Android: Enforce landscape fullscreen mode"). To work around https://github.com/libsdl-org/SDL/issues/8995 where the system bar does not disappear after resuming the app, create the window in non-fullscreen mode. Also, since SDL hints can be configured in AndroidManifest.xml, there is no need to set SDL_HINT_ORIENTATIONS here. --- src/video.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/video.c b/src/video.c index fbcc9e4..54fde3f 100644 --- a/src/video.c +++ b/src/video.c @@ -243,19 +243,12 @@ int gfx_init(void) #endif sdl.format = SDL_AllocFormat(SDL_PIXELFORMAT_RGBA32); - uint32_t window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN; -#ifdef __ANDROID__ - window_flags |= SDL_WINDOW_FULLSCREEN; - SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight"); -#else - window_flags |= SDL_WINDOW_RESIZABLE; -#endif sdl.window = SDL_CreateWindow("XSystem4", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, config.view_width, config.view_height, - window_flags); + SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); if (!sdl.window) ERROR("SDL_CreateWindow failed: %s", SDL_GetError()); From 8d9eb931f66cc14337f1e7f1e0fa390511f87365 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 4 Oct 2025 15:55:56 +0900 Subject: [PATCH 2/2] Redraw screen on SDL_APP_DIDENTERFOREGROUND Without this, the screen remains blank after resuming the app on Android. --- src/input.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/input.c b/src/input.c index cf95007..d52a5cb 100644 --- a/src/input.c +++ b/src/input.c @@ -608,6 +608,9 @@ void handle_events(void) case SDL_WINDOWEVENT: handle_window_event(&e); break; + case SDL_APP_DIDENTERFOREGROUND: + gfx_swap(); + break; case SDL_KEYDOWN: if (e.key.keysym.scancode == SDL_SCANCODE_F9) vm_stack_trace();