aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/linux/src/java
diff options
context:
space:
mode:
authorendolf <[email protected]>2004-04-21 09:48:55 +0000
committerendolf <[email protected]>2004-04-21 09:48:55 +0000
commit4e7cd82fba61afff752a022d70c24627b248addf (patch)
treee4f774c498c73295eec0f55210b23374a1a2b231 /plugins/linux/src/java
parentc641e31461650f8c7886de5e859f3f0582a29579 (diff)
fixes for issues 25 and 26
Sigsgv with logitec USB keyboard with volume controls and mouse wheel when valid event device list in /dev/input/event* has invalid devices in the middle of the sequence, a sigsegv is seen git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@76 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins/linux/src/java')
-rw-r--r--plugins/linux/src/java/net/java/games/input/LinuxDevice.java23
-rw-r--r--plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java4
2 files changed, 12 insertions, 15 deletions
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java
index 059255a..59fb0b2 100644
--- a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java
+++ b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java
@@ -25,11 +25,7 @@
*/
package net.java.games.input;
-import net.java.games.input.AbstractController;
-import net.java.games.input.Axis;
-import net.java.games.input.Controller;
import java.util.ArrayList;
-import java.util.Iterator;
/**
* Represents a device that is not a keyboard or mouse.
@@ -189,13 +185,15 @@ public class LinuxDevice extends AbstractController {
*/
private void createButtons(int numButtons) {
- int supportedButtons[] = new int[numButtons];
- getSupportedButtons(supportedButtons);
- buttons = new LinuxAxis[numButtons];
- for(int i=0;i<numButtons;i++) {
- buttons[i] = createButton(i, supportedButtons[i]);
- //axesArray.add(buttons[i]);
- }
+ int supportedButtons[] = new int[numButtons];
+ buttons = new LinuxAxis[numButtons];
+ if(numButtons>0) {
+ getSupportedButtons(supportedButtons);
+ for(int i=0;i<numButtons;i++) {
+ buttons[i] = createButton(i, supportedButtons[i]);
+ //axesArray.add(buttons[i]);
+ }
+ }
}
/** Create the relative axes for the device
@@ -567,6 +565,9 @@ public class LinuxDevice extends AbstractController {
* @param supportedButtons Array to populate
*/
private void getSupportedButtons(int supportedButtons[]) {
+ if(supportedButtons.length==0) {
+ return;
+ }
getNativeSupportedButtons(nativeID, supportedButtons);
}
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
index 4e0fbe4..09bbfec 100644
--- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
+++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
@@ -25,10 +25,6 @@
*/
package net.java.games.input;
-import java.util.ArrayList;
-import java.util.Iterator;
-import net.java.games.input.Controller;
-import net.java.games.input.ControllerEnvironment;
import net.java.games.util.plugins.Plugin;
/** Environment plugin for linux