only generate events if mouse is actually alive
This commit is contained in:
parent
83dd8b6bbc
commit
3ae8c81129
|
@ -161,11 +161,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableMouseBuffer(JNIE
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleMouseScrolled(int event_dwheel) {
|
void handleMouseScrolled(int event_dwheel) {
|
||||||
|
if(mCreate_success) {
|
||||||
accum_dwheel += event_dwheel;
|
accum_dwheel += event_dwheel;
|
||||||
putMouseEvent(-1, 0, event_dwheel);
|
putMouseEvent(-1, 0, event_dwheel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleMouseMoved(int x, int y) {
|
void handleMouseMoved(int x, int y) {
|
||||||
|
if(mCreate_success) {
|
||||||
y = transformY(y);
|
y = transformY(y);
|
||||||
int dx = x - last_x;
|
int dx = x - last_x;
|
||||||
int dy = y - last_y;
|
int dy = y - last_y;
|
||||||
|
@ -178,10 +181,13 @@ void handleMouseMoved(int x, int y) {
|
||||||
} else {
|
} else {
|
||||||
putMouseEventWithCoords(-1, 0, x, y, 0);
|
putMouseEventWithCoords(-1, 0, x, y, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleMouseButton(int button, int state) {
|
void handleMouseButton(int button, int state) {
|
||||||
|
if(mCreate_success) {
|
||||||
putMouseEvent(button, state, 0);
|
putMouseEvent(button, state, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copyDXEvents(int num_di_events, DIDEVICEOBJECTDATA *di_buffer) {
|
static void copyDXEvents(int num_di_events, DIDEVICEOBJECTDATA *di_buffer) {
|
||||||
|
@ -354,6 +360,7 @@ static void ShutdownMouse() {
|
||||||
lpdi->Release();
|
lpdi->Release();
|
||||||
lpdi = NULL;
|
lpdi = NULL;
|
||||||
}
|
}
|
||||||
|
mCreate_success = false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Enumerates the capabilities of the Mouse attached to the system
|
* Enumerates the capabilities of the Mouse attached to the system
|
||||||
|
|
Loading…
Reference in New Issue