From b07143f4000ac24d5d6b3d662015d372b73c2565 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 5 Jul 2004 14:06:40 +0000 Subject: [PATCH] Made the mouse grab and native cursor properties persistent over destroy()/create() --- src/java/org/lwjgl/input/Cursor.java | 11 ++++- src/java/org/lwjgl/input/Mouse.java | 50 ++++++++++------------ src/native/linux/org_lwjgl_input_Mouse.cpp | 16 ------- 3 files changed, 33 insertions(+), 44 deletions(-) diff --git a/src/java/org/lwjgl/input/Cursor.java b/src/java/org/lwjgl/input/Cursor.java index 6cee815c..67b1e7ea 100644 --- a/src/java/org/lwjgl/input/Cursor.java +++ b/src/java/org/lwjgl/input/Cursor.java @@ -173,9 +173,18 @@ public class Cursor { } /** - * Destroy the native cursor. Cursor must not be current. + * Destroy the native cursor. If the cursor is current, + * the current native cursor is set to null (the default + * OS cursor) */ public void destroy() { + if (Mouse.getNativeCursor() == this) { + try { + Mouse.setNativeCursor(null); + } catch (LWJGLException e) { + // ignore + } + } for(int i=0; i current_x - POINTER_WARP_BORDER && - event.xmotion.x < current_x + POINTER_WARP_BORDER && - event.xmotion.y > current_y - POINTER_WARP_BORDER && - event.xmotion.y < current_y + POINTER_WARP_BORDER) - break; - printfDebug("Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); - } - if (i == WARP_RETRY) - printfDebug("Never got warp event\n");*/ } static void warpPointer(void) {