mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
Ensure we wait on the surface resize before returning from setting fullscreen mode.
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user