mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-01-03 23:39:57 +01:00
Don't poll if we are shutting down
This commit is contained in:
parent
db744e1d41
commit
819e59f33c
|
|
@ -142,6 +142,22 @@ public class JInputLibrary {
|
|||
}
|
||||
}
|
||||
|
||||
/** Call to poll the device at the native library
|
||||
* @param deviceID The native device ID
|
||||
* @param buttonData Array to populate with button values
|
||||
* @param relAxesData Array to populate with relative axes values
|
||||
* @param absAxesData Array to populate with absolute axes values
|
||||
* @return the number of events read
|
||||
*/
|
||||
public static int safePoll(int deviceID, int buttonData[], int relAxesData[], int absAxesData[]) {
|
||||
if(!shutdown) {
|
||||
return poll(deviceID, buttonData, relAxesData, absAxesData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** Get the name of a device from the native library
|
||||
* @param deviceID The device id
|
||||
* @return The devices name
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ public class LinuxDevice extends AbstractController {
|
|||
* @return false if the controller is no longer valid.
|
||||
*/
|
||||
public boolean poll() {
|
||||
int retval = JInputLibrary.poll(nativeID, buttonData, relAxesData, absAxesData);
|
||||
int retval = JInputLibrary.safePoll(nativeID, buttonData, relAxesData, absAxesData);
|
||||
if(retval>=0) return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class LinuxKeyboard extends StandardKeyboard {
|
|||
* @return False if this device is invalid.
|
||||
*/
|
||||
public boolean poll() {
|
||||
int retval = JInputLibrary.poll(nativeID, keyData, dummyRelAxesData, dummyAbsAxesData);
|
||||
int retval = JInputLibrary.safePoll(nativeID, keyData, dummyRelAxesData, dummyAbsAxesData);
|
||||
if(retval>=0) return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue