aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/linux/src/java
diff options
context:
space:
mode:
authorendolf <[email protected]>2005-07-16 15:09:04 +0000
committerendolf <[email protected]>2005-07-16 15:09:04 +0000
commit93647ae6e78b257377ae4805eb7a8e5a568733da (patch)
tree501c4fe7cd1147b23221774843e0358ae58887fb /plugins/linux/src/java
parentd85221f6061b39249b11b26744c1eac1a65a4a45 (diff)
Added cleanup stuff for rumblers, it doesn't fix the code, but is nice
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@106 e343933a-64c8-49c5-92b1-88f2ce3e89e8
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);
+
}