aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/linux/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/linux/src/java')
-rw-r--r--plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java b/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java
index 5c704a9..48d0502 100644
--- a/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java
+++ b/plugins/linux/src/java/net/java/games/input/LinuxDeviceRumbler.java
@@ -8,6 +8,12 @@ public class LinuxDeviceRumbler implements Rumbler {
public LinuxDeviceRumbler(int deviceID) {
this.deviceID = deviceID;
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ public void run() {
+ cleanup();
+ }
+ });
}
public void rumble(float intensity) {
@@ -25,5 +31,12 @@ public class LinuxDeviceRumbler implements Rumbler {
return null;
}
+ private void cleanup() {
+ nativeCleanup(deviceID);
+ }
+
private native void nativeRumble(int deviceID, float intensity);
+
+ private native void nativeCleanup(int deviceID);
+
}