Fixed screen orientation not restored in TeeWorlds

This commit is contained in:
pelya
2014-03-02 19:03:30 +02:00
parent 728455e957
commit 3ceac1c8a1

View File

@@ -1055,12 +1055,14 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
if( Globals.NonBlockingSwapBuffers ) if( Globals.NonBlockingSwapBuffers )
return false; return false;
} }
while (needToWait()) { }
//Log.v("SDL", "GLSurfaceView_SDL::run(): paused"); while (needToWait()) {
try { //Log.v("SDL", "GLSurfaceView_SDL::run(): paused");
wait(500); try {
} catch(Exception e) { } wait(500);
} } catch(Exception e) { }
}
synchronized (this) {
if (mDone) { if (mDone) {
return false; return false;
} }
@@ -1108,16 +1110,21 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
return true; // We're in lockscreen - sleep until user unlocks the device return true; // We're in lockscreen - sleep until user unlocks the device
} }
if (mDone) { synchronized (this) {
return false; if (mDone) {
} return false;
}
if (mPaused || (! mHasSurface)) { if ( Globals.HorizontalOrientation != (mWidth > mHeight) )
return true; return true; // Wait until screen orientation changes
}
if ((mWidth > 0) && (mHeight > 0) && (mRequestRender || (mRenderMode == RENDERMODE_CONTINUOUSLY))) { if (mPaused || (! mHasSurface)) {
return false; return true;
}
if ((mWidth > 0) && (mHeight > 0) && (mRequestRender || (mRenderMode == RENDERMODE_CONTINUOUSLY))) {
return false;
}
} }
return true; return true;
@@ -1178,6 +1185,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
} }
public void onWindowResize(int w, int h) { public void onWindowResize(int w, int h) {
Log.v("SDL", "GLSurfaceView_SDL::onWindowResize(): " + w + "x" + h);
synchronized (this) { synchronized (this) {
mWidth = w; mWidth = w;
mHeight = h; mHeight = h;