Move force trigger screen size to GLFW stub side

This commit is contained in:
khanhduytran0
2020-11-09 14:30:58 +07:00
parent eb349a1573
commit fee541c9a4
3 changed files with 5 additions and 8 deletions

View File

@@ -631,7 +631,7 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
case MotionEvent.ACTION_POINTER_DOWN: // 5
CallbackBridge.sendPrepareGrabInitialPos();
CallbackBridge.sendMouseKeycode(!CallbackBridge.mouseLeft ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, 0, true);
CallbackBridge.sendMouseKeycode(CallbackBridge.mouseLeft ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, 0, true);
initialX = x;
initialY = y;

View File

@@ -29,14 +29,11 @@ public class CallbackBridge {
sendMouseKeycode(button, 0, state == 1);
}
private static boolean threadAttached, screenSizeSet;
private static boolean threadAttached;
public static void sendCursorPos(int x, int y) {
if (!threadAttached) {
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, isMinecraft1p12, MainActivity.isInputStackCall);
}
if (!screenSizeSet) {
screenSizeSet = nativeSendScreenSize(windowWidth, windowHeight);
}
DEBUG_STRING.append("CursorPos=" + x + ", " + y + "\n");
mouseX = x;
@@ -136,7 +133,7 @@ public class CallbackBridge {
private static native void nativeSendKey(int key, int scancode, int action, int mods);
private static native void nativeSendMouseButton(int button, int action, int mods);
private static native void nativeSendScroll(double xoffset, double yoffset);
private static native boolean nativeSendScreenSize(int width, int height);
private static native void nativeSendScreenSize(int width, int height);
public static native boolean nativeIsGrabbing();