Win32: Fixes for previous commit
This commit is contained in:
parent
e31b1ee12d
commit
28aff73635
|
@ -179,6 +179,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createMouse(JNIEnv *en
|
||||||
|
|
||||||
last_x = last_y = accum_dx = accum_dy = accum_dwheel = 0;
|
last_x = last_y = accum_dx = accum_dy = accum_dwheel = 0;
|
||||||
buffer_enabled = false;
|
buffer_enabled = false;
|
||||||
|
mouse_grabbed = false;
|
||||||
|
|
||||||
// Create input
|
// Create input
|
||||||
ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL);
|
ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL);
|
||||||
|
@ -205,11 +206,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createMouse(JNIEnv *en
|
||||||
ShutdownMouse();
|
ShutdownMouse();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Aquire the Mouse */
|
|
||||||
ret = IDirectInputDevice_Acquire(mDIDevice);
|
|
||||||
if(FAILED(ret)) {
|
|
||||||
printfDebug("Failed to acquire mouse\n");
|
|
||||||
}
|
|
||||||
created = true;
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +243,7 @@ void handleMouseButton(int button, int state) {
|
||||||
if(created) {
|
if(created) {
|
||||||
putMouseEvent(button, state, 0);
|
putMouseEvent(button, state, 0);
|
||||||
if (button < BUTTON_STATES_SIZE)
|
if (button < BUTTON_STATES_SIZE)
|
||||||
win32_message_button_states[button] = state != 0 : JNI_TRUE: JNI_FALSE;
|
win32_message_button_states[button] = state != 0 ? JNI_TRUE: JNI_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,13 +382,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_grabMouse
|
||||||
if(grab) {
|
if(grab) {
|
||||||
if (!mouse_grabbed) {
|
if (!mouse_grabbed) {
|
||||||
mouse_grabbed = true;
|
mouse_grabbed = true;
|
||||||
ShowCursor(false);
|
|
||||||
IDirectInputDevice_Acquire(mDIDevice);
|
IDirectInputDevice_Acquire(mDIDevice);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mouse_grabbed) {
|
if (mouse_grabbed) {
|
||||||
mouse_grabbed = false;
|
mouse_grabbed = false;
|
||||||
ShowCursor(true);
|
|
||||||
IDirectInputDevice_Unacquire(mDIDevice);
|
IDirectInputDevice_Unacquire(mDIDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue