mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 07:39:00 -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(isGrabbing){
|
||||||
if(!hasPointerCapture) {
|
if(!hasPointerCapture) {
|
||||||
requestFocus();
|
requestFocus();
|
||||||
requestPointerCapture();
|
if(hasWindowFocus()) requestPointerCapture();
|
||||||
|
// Otherwise, onWindowFocusChanged() would get called.
|
||||||
}
|
}
|
||||||
return;
|
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 */
|
/** A small interface called when the listener is ready for the first time */
|
||||||
public interface SurfaceReadyListener {
|
public interface SurfaceReadyListener {
|
||||||
void isReady();
|
void isReady();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user