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 Fri Nov 14 16:28:29 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,31 @@ 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; + } + } + + 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 +1101,10 @@ }); SDLActivity.mSDLThread.start(); } + + if (SDLActivity.mHasFocus) { + SDLActivity.handleResume(); + } } // unused