Linux: Fix Mouse.setCursorPosition()
This commit is contained in:
parent
0b1939dce5
commit
94f39655a5
|
@ -344,14 +344,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReadMouse(JNIEnv *env
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetCursorPosition(JNIEnv * env, jclass clazz, jint x, jint y) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetCursorPosition(JNIEnv * env, jclass clazz, jint x, jint y) {
|
||||||
XWindowAttributes attributes;
|
XWarpPointer(getDisplay(), None, getCurrentWindow(), 0, 0, 0, 0, x, transformY(y));
|
||||||
if (!XGetWindowAttributes(getDisplay(), getCurrentWindow(), &attributes)) {
|
|
||||||
printfDebugJava(env, "XGetWindowAttributes failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int transformed_x = attributes.x + x;
|
|
||||||
int transformed_y = attributes.y + transformY(y);
|
|
||||||
XWarpPointer(getDisplay(), None, getCurrentWindow(), 0, 0, 0, 0, transformed_x, transformed_y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabMouse(JNIEnv * env, jclass clazz, jboolean new_grab) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabMouse(JNIEnv * env, jclass clazz, jboolean new_grab) {
|
||||||
|
|
Loading…
Reference in New Issue