mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 06:39:54 -04:00
Only fire cursor pos callback if detect move
This commit is contained in:
parent
69f4e4841b
commit
fe82d4418c
@ -121,8 +121,9 @@ void invokeCursorPos(int x, int y) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!isUseStackQueueCall)
|
||||
if (!isUseStackQueueCall) {
|
||||
GLFW_invoke_CursorPos(showingWindow, (double) (isGrabbing ? grabCursorX : x), (double) (isGrabbing ? grabCursorY : y));
|
||||
}
|
||||
lastCursorX = x;
|
||||
lastCursorY = y;
|
||||
}
|
||||
@ -159,24 +160,24 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeIsGrabbing(J
|
||||
return isGrabbing;
|
||||
}
|
||||
|
||||
int diffX, diffY, logTimes;
|
||||
int diffX, diffY, diffGrabX, diffGrabY;
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwPollEvents(JNIEnv* env, jclass clazz) {
|
||||
if (!isInputReady) isInputReady = true;
|
||||
if (isUseStackQueueCall) {
|
||||
/*
|
||||
LOGI("Mouse pos curr! x=%d, y=%d; Input length=%d", lastCursorX, lastCursorY, glfwInputEventIndex);
|
||||
if (diffX != lastCursorX || diffY != lastCursorY) {
|
||||
if (logTimes < 1000) {
|
||||
logTimes++;
|
||||
LOGI("Mouse pos diff! x=%d, y=%d", lastCursorX, lastCursorY);
|
||||
}
|
||||
if (!isGrabbing && (diffX != lastCursorX || diffY != lastCursorY)) {
|
||||
diffX = lastCursorX;
|
||||
diffY = lastCursorY;
|
||||
}
|
||||
*/
|
||||
|
||||
if (GLFW_invoke_CursorPos) {
|
||||
GLFW_invoke_CursorPos(showingWindow, (double) (isGrabbing ? grabCursorX : lastCursorX), (double) (isGrabbing ? grabCursorY : lastCursorY));
|
||||
GLFW_invoke_CursorPos(showingWindow, (double) lastCursorX), (double) lastCursorY));
|
||||
}
|
||||
} else if (isGrabbing && (diffGrabX != grabCursorX || diffGrabY != grabCursorY)) {
|
||||
diffGrabX = grabCursorX;
|
||||
diffGrabY = grabCursorY;
|
||||
|
||||
if (GLFW_invoke_CursorPos) {
|
||||
GLFW_invoke_CursorPos(showingWindow, (double) grabCursorX, (double) grabCursorY);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < glfwInputEventIndex; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user