Mac OS X: Don't hide mouse mouse when already hidden (because the cursor state is counted)
This commit is contained in:
parent
26ce1fecae
commit
f65ae73d47
|
@ -270,9 +270,9 @@ final class MacOSXDisplay implements DisplayImplementation {
|
|||
}
|
||||
|
||||
public void grabMouse(boolean grab) {
|
||||
nGrabMouse(grab);
|
||||
mouse_queue.setGrabbed(grab);
|
||||
warpCursor();
|
||||
nGrabMouse(grab);
|
||||
}
|
||||
|
||||
private native void nWarpCursor(int x, int y);
|
||||
|
@ -294,7 +294,7 @@ final class MacOSXDisplay implements DisplayImplementation {
|
|||
with another setCursor.
|
||||
2. When the cursor is moving in the top pixel row (y = 0 in AWT coordinates) in fullscreen
|
||||
mode, no mouse moved events are reported, even though mouse pressed/released and dragged
|
||||
are reported
|
||||
events are reported
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -43,12 +43,18 @@
|
|||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include "common_tools.h"
|
||||
|
||||
static bool is_grabbed;
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGrabMouse(JNIEnv *env, jobject this, jboolean grab) {
|
||||
CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE);
|
||||
if (grab == JNI_TRUE)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nWarpCursor(JNIEnv *env, jobject this, jint x, jint y) {
|
||||
|
|
Loading…
Reference in New Issue