mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-02-04 11:15:57 +01:00
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) {
|
if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) {
|
||||||
SDLActivity.mIsPaused = false;
|
SDLActivity.mIsPaused = false;
|
||||||
SDLActivity.nativeResume();
|
SDLActivity.nativeResume();
|
||||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
mSurface.handleResume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,6 +551,15 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
mHeight = 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() {
|
public Surface getNativeSurface() {
|
||||||
return getHolder().getSurface();
|
return getHolder().getSurface();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user