mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 14:51:51 -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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isUseStackQueueCall)
|
if (!isUseStackQueueCall) {
|
||||||
GLFW_invoke_CursorPos(showingWindow, (double) (isGrabbing ? grabCursorX : x), (double) (isGrabbing ? grabCursorY : y));
|
GLFW_invoke_CursorPos(showingWindow, (double) (isGrabbing ? grabCursorX : x), (double) (isGrabbing ? grabCursorY : y));
|
||||||
|
}
|
||||||
lastCursorX = x;
|
lastCursorX = x;
|
||||||
lastCursorY = y;
|
lastCursorY = y;
|
||||||
}
|
}
|
||||||
@ -159,24 +160,24 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeIsGrabbing(J
|
|||||||
return isGrabbing;
|
return isGrabbing;
|
||||||
}
|
}
|
||||||
|
|
||||||
int diffX, diffY, logTimes;
|
int diffX, diffY, diffGrabX, diffGrabY;
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwPollEvents(JNIEnv* env, jclass clazz) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwPollEvents(JNIEnv* env, jclass clazz) {
|
||||||
if (!isInputReady) isInputReady = true;
|
if (!isInputReady) isInputReady = true;
|
||||||
if (isUseStackQueueCall) {
|
if (isUseStackQueueCall) {
|
||||||
/*
|
if (!isGrabbing && (diffX != lastCursorX || diffY != lastCursorY)) {
|
||||||
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);
|
|
||||||
}
|
|
||||||
diffX = lastCursorX;
|
diffX = lastCursorX;
|
||||||
diffY = lastCursorY;
|
diffY = lastCursorY;
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (GLFW_invoke_CursorPos) {
|
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++) {
|
for (int i = 0; i < glfwInputEventIndex; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user