diff --git a/src/native/macosx/org_lwjgl_input_Mouse.c b/src/native/macosx/org_lwjgl_input_Mouse.c index f7f824dd..2c33a901 100644 --- a/src/native/macosx/org_lwjgl_input_Mouse.c +++ b/src/native/macosx/org_lwjgl_input_Mouse.c @@ -44,18 +44,12 @@ #include "org_lwjgl_opengl_MacOSXMouseEventQueue.h" #include "common_tools.h" -static bool is_grabbed; - JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse(JNIEnv *env, jclass unused, jboolean grab) { - bool new_grabbed = grab == JNI_TRUE; - if (is_grabbed != new_grabbed) { - is_grabbed = new_grabbed; - CGAssociateMouseAndMouseCursorPosition(is_grabbed ? FALSE : TRUE); - if (is_grabbed) - CGDisplayHideCursor(kCGDirectMainDisplay); - else - CGDisplayShowCursor(kCGDirectMainDisplay); - } + CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE); + if (grab) + CGDisplayHideCursor(kCGDirectMainDisplay); + else + CGDisplayShowCursor(kCGDirectMainDisplay); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor(JNIEnv *env, jclass unused, jint x, jint y) {