oops, windows mousegrab fixed

This commit is contained in:
kappa1 2010-03-26 19:52:40 +00:00
parent b272e7d891
commit 8cee11ede7
1 changed files with 4 additions and 4 deletions

View File

@ -614,14 +614,15 @@ public class Mouse {
*/ */
public static void setGrabbed(boolean grab) { public static void setGrabbed(boolean grab) {
synchronized (OpenGLPackageAccess.global_lock) { synchronized (OpenGLPackageAccess.global_lock) {
boolean grabbed = isGrabbed;
isGrabbed = grab;
if (isCreated()) { if (isCreated()) {
if (grab && !isGrabbed) { if (grab && !grabbed) {
// store location mouse was grabbed // store location mouse was grabbed
grab_x = x; grab_x = x;
grab_y = y; grab_y = y;
} }
else if (!grab && isGrabbed) { else if (!grab && grabbed) {
// move mouse back to location it was grabbed before ungrabbing // move mouse back to location it was grabbed before ungrabbing
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0)
implementation.setCursorPosition(grab_x, grab_y); implementation.setCursorPosition(grab_x, grab_y);
@ -634,7 +635,6 @@ public class Mouse {
event_y = y; event_y = y;
resetMouse(); resetMouse();
} }
isGrabbed = grab;
} }
} }