diff -r 1cb6ac648db7 android-project/src/org/libsdl/app/SDLActivity.java --- a/android-project/src/org/libsdl/app/SDLActivity.java Sun Nov 09 14:20:53 2014 -0500 +++ b/android-project/src/org/libsdl/app/SDLActivity.java Sun Nov 30 08:05:49 2014 +0100 @@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable; import android.media.*; import android.hardware.*; +import android.content.pm.ActivityInfo; /** SDL Activity @@ -1044,6 +1045,42 @@ SDLActivity.onNativeResize(width, height, sdlFormat); Log.v("SDL", "Window size:" + width + "x"+height); + + boolean skip = false; + int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation(); + + if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) + { + // Accept any + } + else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) + { + if (mWidth > mHeight) { + skip = true; + } + } else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { + if (mWidth < mHeight) { + skip = true; + } + } + + // Special Patch for Square Resolution: Black Berry Passport + if (skip) { + double min = Math.min(mWidth, mHeight); + double max = Math.max(mWidth, mHeight); + + if (max / min < 1.20) { + Log.v("SDL", "Don't skip on such aspect-ratio. Could be a square resolution."); + skip = false; + } + } + + if (skip) { + Log.v("SDL", "Skip .. Surface is not ready."); + return; + } + + // Set mIsSurfaceReady to 'true' *before* making a call to handleResume SDLActivity.mIsSurfaceReady = true; SDLActivity.onNativeSurfaceChanged(); @@ -1075,6 +1112,10 @@ }); SDLActivity.mSDLThread.start(); } + + if (SDLActivity.mHasFocus) { + SDLActivity.handleResume(); + } } // unused