From 93647ae6e78b257377ae4805eb7a8e5a568733da Mon Sep 17 00:00:00 2001 From: endolf Date: Sat, 16 Jul 2005 15:09:04 +0000 Subject: 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 --- .../src/java/net/java/games/input/LinuxDeviceRumbler.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'plugins/linux/src/java') 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); + } -- cgit v1.2.3