From 533fb6882fc40ce1b50ffa9ae2839b8c65866c63 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 23 Nov 2003 12:52:08 +0000 Subject: [PATCH] Native cursor fix in win32 --- src/native/win32/org_lwjgl_input_Mouse.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/native/win32/org_lwjgl_input_Mouse.cpp b/src/native/win32/org_lwjgl_input_Mouse.cpp index 85f9dd92..37ec083d 100644 --- a/src/native/win32/org_lwjgl_input_Mouse.cpp +++ b/src/native/win32/org_lwjgl_input_Mouse.cpp @@ -249,18 +249,18 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor (JNIEnv *env, jclass clazz, jlong cursor_handle) { + if (mDIDevice == NULL) + throwException(env, "null device!"); if (cursor_handle != 0) { - if (mDIDevice == NULL) - throwException(env, "null device!"); - mDIDevice->Unacquire(); - if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { - throwException(env, "Could not set the CooperativeLevel."); - return; - } HCURSOR cursor = (HCURSOR)cursor_handle; SetClassLong(hwnd, GCL_HCURSOR, (LONG)cursor); SetCursor(cursor); if (!usingNativeCursor) { + mDIDevice->Unacquire(); + if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { + throwException(env, "Could not set the CooperativeLevel."); + return; + } /* Reset cursor position to middle of the window */ RECT clientRect; GetWindowRect(hwnd, &windowRect); @@ -282,6 +282,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor } ShowCursor(FALSE); usingNativeCursor = false; + mDIDevice->Acquire(); } } }