From 2b0bdf9979ac5dd092883685843000c9f0884f4a Mon Sep 17 00:00:00 2001 From: endolf Date: Wed, 21 Apr 2004 16:19:42 +0000 Subject: Updated the type guess code so that anything that doesn't have a characteristic of a particular type, wont get guessed as that type, it was possible for devices with no characteristics of any of the known types to be classed as a stick, now it should not. git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@78 e343933a-64c8-49c5-92b1-88f2ce3e89e8 --- .../linux/src/java/net/java/games/input/LinuxDevice.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'plugins') 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 5fa49d6..0ed7c98 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java @@ -355,22 +355,26 @@ public class LinuxDevice extends AbstractController { // no sweat, it's non of the above, erg } } - if((joystickCharacteristic >= digitiserCharacteristic) && + if((joystickCharacteristic > 0) && + (joystickCharacteristic >= digitiserCharacteristic) && (joystickCharacteristic >= gamepadCharacteristic) && (joystickCharacteristic >= miscCharacteristic) && (joystickCharacteristic >= mouseCharacteristic)) { typeGuess = Type.STICK; - } else if((gamepadCharacteristic >= digitiserCharacteristic) && + } else if((gamepadCharacteristic > 0) && + (gamepadCharacteristic >= digitiserCharacteristic) && (gamepadCharacteristic >= joystickCharacteristic) && (gamepadCharacteristic >= miscCharacteristic) && (gamepadCharacteristic >= mouseCharacteristic)) { typeGuess = Type.GAMEPAD; - } else if((digitiserCharacteristic >= gamepadCharacteristic) && + } else if((digitiserCharacteristic > 0) && + (digitiserCharacteristic >= gamepadCharacteristic) && (digitiserCharacteristic >= joystickCharacteristic) && (digitiserCharacteristic >= miscCharacteristic) && (digitiserCharacteristic >= mouseCharacteristic)) { typeGuess = Type.TRACKPAD; - } else if((miscCharacteristic >= gamepadCharacteristic) && + } else if((miscCharacteristic > 0) && + (miscCharacteristic >= gamepadCharacteristic) && (miscCharacteristic >= joystickCharacteristic) && (miscCharacteristic >= miscCharacteristic) && (miscCharacteristic >= mouseCharacteristic)) { @@ -378,7 +382,8 @@ public class LinuxDevice extends AbstractController { // wise a LinuxKeyboard would have been constructed, so assume its // some kind of stick; typeGuess = Type.STICK; - } else if((mouseCharacteristic >= digitiserCharacteristic) && + } else if((mouseCharacteristic > 0) && + (mouseCharacteristic >= digitiserCharacteristic) && (mouseCharacteristic >= joystickCharacteristic) && (mouseCharacteristic >= miscCharacteristic) && (mouseCharacteristic >= gamepadCharacteristic)) { -- cgit v1.2.3