Skip to content

Commit

Permalink
Android: prevent ignoring surfaceChanged() in MultiWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Jun 18, 2019
1 parent 98cc758 commit 5418d41
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
Expand Up @@ -1739,6 +1739,8 @@ public void surfaceChanged(SurfaceHolder holder,
SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate());
SDLActivity.onNativeResize();

// Prevent a screen distortion glitch,
// for instance when the device is in Landscape and a Portrait App is resumed.
boolean skip = false;
int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation();

Expand Down Expand Up @@ -1768,6 +1770,16 @@ else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || req
}
}

// Don't skip in MultiWindow.
if (skip) {
if (Build.VERSION.SDK_INT >= 24) {
if (SDLActivity.mSingleton.isInMultiWindowMode()) {
Log.v("SDL", "Don't skip in Multi-Window");
skip = false;
}
}
}

if (skip) {
Log.v("SDL", "Skip .. Surface is not ready.");
mIsSurfaceReady = false;
Expand Down

0 comments on commit 5418d41

Please sign in to comment.