diff --git a/src/java/org/lwjgl/opengl/WindowsAWTInput.java b/src/java/org/lwjgl/opengl/WindowsAWTInput.java index e0cfd3b7..41e95f4e 100644 --- a/src/java/org/lwjgl/opengl/WindowsAWTInput.java +++ b/src/java/org/lwjgl/opengl/WindowsAWTInput.java @@ -99,15 +99,24 @@ final class WindowsAWTInput extends AbstractAWTInput { cached_mouse = new WindowsMouse(dinput, hwnd); // cached_keyboard = new WindowsKeyboard(dinput, hwnd); } - if (isGrabbed() && getCanvas().getCursor() != blank_cursor) { - cached_cursor = getCanvas().getCursor(); + if (isGrabbed()) { /** - * For some reason, DirectInput won't let us blank the cursor - * with the EXCLUSIVE access mode, so we'll work around it with a - * custom blank cursor + * DirectInput won't always stop the cursor from moving on top of the + * task bar and clicking on it. So we'll use ClipCursor to + * contain it while the cursor is grabbed. */ - getCanvas().setCursor(blank_cursor); - } + WindowsDisplay.setupCursorClipping(hwnd); + if (getCanvas().getCursor() != blank_cursor) { + cached_cursor = getCanvas().getCursor(); + /** + * For some reason, DirectInput won't let us blank the cursor + * with the EXCLUSIVE access mode, so we'll work around it with a + * custom blank cursor + */ + getCanvas().setCursor(blank_cursor); + } + } else + WindowsDisplay.resetCursorClipping(); grab(isGrabbed()); } catch (LWJGLException e) { LWJGLUtil.log("Failed to create windows mouse: " + e); diff --git a/src/java/org/lwjgl/opengl/WindowsDisplay.java b/src/java/org/lwjgl/opengl/WindowsDisplay.java index e067575e..1dd09dbe 100644 --- a/src/java/org/lwjgl/opengl/WindowsDisplay.java +++ b/src/java/org/lwjgl/opengl/WindowsDisplay.java @@ -145,8 +145,8 @@ final class WindowsDisplay implements DisplayImplementation { resetCursorClipping(); } private static native void nDestroyWindow(); - private static native void resetCursorClipping(); - private static native void setupCursorClipping(long hwnd) throws LWJGLException; + static native void resetCursorClipping(); + static native void setupCursorClipping(long hwnd) throws LWJGLException; public void switchDisplayMode(DisplayMode mode) throws LWJGLException { nSwitchDisplayMode(mode);