Skip to content

Commit

Permalink
Android: Fix changing orientation with t.window.fullscreen = true
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuAuahDark committed Dec 25, 2020
1 parent fe23c16 commit 9c4db00
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/modules/window/sdl/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,16 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)

Uint32 sdlflags = SDL_WINDOW_OPENGL;

// On Android we always must have fullscreen type FULLSCREEN_TYPE_DESKTOP
// On Android, disable fullscreen first on window creation so it's
// possible to change the orientation by specifying portait width and
// height, otherwise SDL will pick the current orientation dimensions when
// fullscreen flag is set. Don't worry, we'll set it back later when user
// also requested fullscreen after the window is created.
// See https://github.com/love2d/love-android/issues/196
#ifdef LOVE_ANDROID
bool fullscreen = f.fullscreen;

f.fullscreen = false;
f.fstype = FULLSCREEN_DESKTOP;
#endif

Expand Down Expand Up @@ -527,8 +535,11 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
graphics->setMode((int) scaledw, (int) scaledh, pixelWidth, pixelHeight, f.stencil);
}

// Set fullscreen when user requested it before.
// See above for explanation.
#ifdef LOVE_ANDROID
love::android::setImmersive(f.fullscreen);
setFullscreen(fullscreen);
love::android::setImmersive(fullscreen);
#endif

return true;
Expand Down

0 comments on commit 9c4db00

Please sign in to comment.