mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 14:51:51 -04:00
Fix[mousegrab]: edit mouse grab code to follow android guidelines
https://developer.android.com/develop/ui/views/touch-and-input/gestures/movement#pointer-capture
This commit is contained in:
parent
c773b92527
commit
540d8b5940
@ -624,7 +624,8 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
||||
if(isGrabbing){
|
||||
if(!hasPointerCapture) {
|
||||
requestFocus();
|
||||
requestPointerCapture();
|
||||
if(hasWindowFocus()) requestPointerCapture();
|
||||
// Otherwise, onWindowFocusChanged() would get called.
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -635,6 +636,13 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
super.onWindowFocusChanged(hasWindowFocus);
|
||||
if(hasWindowFocus && CallbackBridge.isGrabbing() &&
|
||||
MainActivity.isAndroid8OrHigher()) requestPointerCapture();
|
||||
}
|
||||
|
||||
/** A small interface called when the listener is ready for the first time */
|
||||
public interface SurfaceReadyListener {
|
||||
void isReady();
|
||||
|
Loading…
x
Reference in New Issue
Block a user