From: <eli...@us...> - 2007-01-30 13:08:55
|
Revision: 2734 http://svn.sourceforge.net/java-game-lib/?rev=2734&view=rev Author: elias_naur Date: 2007-01-30 05:08:51 -0800 (Tue, 30 Jan 2007) Log Message: ----------- Windows AWTInput: Make sure the cursor is contained within the window when the Mouse is grabbed. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java 2007-01-23 19:55:46 UTC (rev 2733) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java 2007-01-30 13:08:51 UTC (rev 2734) @@ -99,15 +99,24 @@ 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); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2007-01-23 19:55:46 UTC (rev 2733) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2007-01-30 13:08:51 UTC (rev 2734) @@ -145,8 +145,8 @@ 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |