diff --git a/src/native/macosx/org_lwjgl_opengl_Display.m b/src/native/macosx/org_lwjgl_opengl_Display.m index 20eae51a..7890acc4 100644 --- a/src/native/macosx/org_lwjgl_opengl_Display.m +++ b/src/native/macosx/org_lwjgl_opengl_Display.m @@ -395,7 +395,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetX(JNIEnv *env, jo JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetY(JNIEnv *env, jobject this, jobject window_handle) { MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); - NSRect screenRect = [[[window_info->view window] screen] frame]; + NSRect screenRect = [[window_info->window screen] frame]; NSRect winRect = [[window_info->view window] frame]; // get top corner of window frame, also flip coords so origin is in top left diff --git a/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m b/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m index e35c34a5..37947810 100644 --- a/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m +++ b/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m @@ -70,7 +70,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursorPositio p.y = point.y; } else { - NSRect screenRect = [[NSScreen mainScreen] frame]; + NSRect screenRect = [[window_info->window screen] frame]; NSRect viewRect = [window_info->view frame]; NSRect winRect = [window_info->window frame]; @@ -81,11 +81,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursorPositio p.y = winRect.origin.y + viewPoint.y + (viewRect.size.height - y - 1); p.x = winRect.origin.x + viewPoint.x + x; - // flip y coordinates (origin top left) to allow use with CGWarpMouseCursorPosition + // flip y coordinates (origin top left) to allow use with CGDisplayMoveCursorToPoint p.y = screenRect.size.height - p.y - 1; } - CGWarpMouseCursorPosition(p); + CGDisplayMoveCursorToPoint(CGMainDisplayID(), p); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nRegisterMouseListener(JNIEnv *env, jobject _this, jobject window_handle) {