Ensure we wait on the surface resize before returning from setting fullscreen mode.

This commit is contained in:
Sam Lantinga 2018-09-28 20:39:57 -07:00
parent c9fd1e0c97
commit 6911c8ca79
4 changed files with 30 additions and 1 deletions

View file

@ -643,7 +643,22 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
Message msg = commandHandler.obtainMessage();
msg.arg1 = command;
msg.obj = data;
return commandHandler.sendMessage(msg);
boolean result = commandHandler.sendMessage(msg);
// Ensure we don't return until the resize has actually happened,
// or 250ms have passed.
if (command == COMMAND_CHANGE_WINDOW_STYLE) {
synchronized(SDLActivity.getContext()) {
try {
SDLActivity.getContext().wait(250);
}
catch (InterruptedException ie) {
ie.printStackTrace();
}
}
}
return result;
}
// C functions we call
@ -1577,6 +1592,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
catch ( java.lang.Throwable throwable ) {}
synchronized(SDLActivity.getContext()) {
SDLActivity.getContext().notifyAll();
}
Log.v("SDL", "Window size: " + width + "x" + height);
Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight);
SDLActivity.onNativeResize(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate());