mirror of https://github.com/libsdl-org/SDL
Improve handling of focus behaviour on Android. Patch by Alexey Petruchik
This commit is contained in:
parent
b701175ab5
commit
d5a2e55d48
|
@ -190,7 +190,7 @@ public class SDLActivity extends Activity {
|
|||
if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) {
|
||||
SDLActivity.mIsPaused = false;
|
||||
SDLActivity.nativeResume();
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
mSurface.handleResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,6 +550,15 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||
mWidth = 1.0f;
|
||||
mHeight = 1.0f;
|
||||
}
|
||||
|
||||
public void handleResume() {
|
||||
setFocusable(true);
|
||||
setFocusableInTouchMode(true);
|
||||
requestFocus();
|
||||
setOnKeyListener(this);
|
||||
setOnTouchListener(this);
|
||||
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
}
|
||||
|
||||
public Surface getNativeSurface() {
|
||||
return getHolder().getSurface();
|
||||
|
|
Loading…
Reference in New Issue