mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 14:16:58 -04:00
fix(Pointer): Properly handle hold-clicks
This commit is contained in:
parent
19b81e10ea
commit
f37ebfada1
@ -1,6 +1,7 @@
|
|||||||
package net.kdt.pojavlaunch;
|
package net.kdt.pojavlaunch;
|
||||||
|
|
||||||
import static net.kdt.pojavlaunch.MainActivity.touchCharInput;
|
import static net.kdt.pojavlaunch.MainActivity.touchCharInput;
|
||||||
|
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_MOUSE_GRAB_FORCE;
|
||||||
import static net.kdt.pojavlaunch.utils.MCOptionUtils.getMcScale;
|
import static net.kdt.pojavlaunch.utils.MCOptionUtils.getMcScale;
|
||||||
import static org.lwjgl.glfw.CallbackBridge.sendMouseButton;
|
import static org.lwjgl.glfw.CallbackBridge.sendMouseButton;
|
||||||
import static org.lwjgl.glfw.CallbackBridge.windowHeight;
|
import static org.lwjgl.glfw.CallbackBridge.windowHeight;
|
||||||
@ -193,6 +194,13 @@ public class MinecraftGLSurface extends View implements GrabListener, DirectGame
|
|||||||
if(toolType == MotionEvent.TOOL_TYPE_MOUSE) {
|
if(toolType == MotionEvent.TOOL_TYPE_MOUSE) {
|
||||||
if(Tools.isAndroid8OrHigher() &&
|
if(Tools.isAndroid8OrHigher() &&
|
||||||
mPointerCapture != null) {
|
mPointerCapture != null) {
|
||||||
|
// Can't handleAutomaticCapture if mouse isn't captured
|
||||||
|
if (!CallbackBridge.isGrabbing() // Only capture if not in menu and user said so
|
||||||
|
&& !PREF_MOUSE_GRAB_FORCE) {
|
||||||
|
// This returns true but we really can't consume this.
|
||||||
|
// Else we don't receive ACTION_MOVE
|
||||||
|
return !dispatchGenericMotionEvent(e);
|
||||||
|
}
|
||||||
mPointerCapture.handleAutomaticCapture();
|
mPointerCapture.handleAutomaticCapture();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -241,9 +249,9 @@ public class MinecraftGLSurface extends View implements GrabListener, DirectGame
|
|||||||
|
|
||||||
// Make sure we grabbed the mouse if necessary
|
// Make sure we grabbed the mouse if necessary
|
||||||
updateGrabState(CallbackBridge.isGrabbing());
|
updateGrabState(CallbackBridge.isGrabbing());
|
||||||
|
|
||||||
switch(event.getActionMasked()) {
|
switch(event.getActionMasked()) {
|
||||||
case MotionEvent.ACTION_HOVER_MOVE:
|
case MotionEvent.ACTION_HOVER_MOVE:
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
CallbackBridge.mouseX = (event.getX(mouseCursorIndex) * LauncherPreferences.PREF_SCALE_FACTOR);
|
CallbackBridge.mouseX = (event.getX(mouseCursorIndex) * LauncherPreferences.PREF_SCALE_FACTOR);
|
||||||
CallbackBridge.mouseY = (event.getY(mouseCursorIndex) * LauncherPreferences.PREF_SCALE_FACTOR);
|
CallbackBridge.mouseY = (event.getY(mouseCursorIndex) * LauncherPreferences.PREF_SCALE_FACTOR);
|
||||||
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
|
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user