From 08a2e8a010b6c2d22b41e1eb406152efb5964f8c Mon Sep 17 00:00:00 2001 From: kappa1 Date: Sat, 27 Mar 2010 16:04:30 +0000 Subject: [PATCH] Further improvement to mouse ungrab position behaviour. Mouse no longer limited to just ungrabbing at the position it was grabbed, now you can can call setCursorPosition(x,y) while mouse is grabbed and ungrab the mouse at any position you like. --- src/java/org/lwjgl/input/Mouse.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java index 551f9dfc..1ecbc270 100644 --- a/src/java/org/lwjgl/input/Mouse.java +++ b/src/java/org/lwjgl/input/Mouse.java @@ -204,8 +204,13 @@ public class Mouse { throw new IllegalStateException("Mouse is not created"); x = event_x = new_x; y = event_y = new_y; - if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) + if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) { implementation.setCursorPosition(x, y); + } + else { + grab_x = new_x; + grab_y = new_y; + } } }