diff options
author | endolf <[email protected]> | 2004-08-29 21:23:06 +0000 |
---|---|---|
committer | endolf <[email protected]> | 2004-08-29 21:23:06 +0000 |
commit | 48d90dc92ba7be418b983bbd523e1fd8c33fa25f (patch) | |
tree | 55230e67cf5833c4e5ed50d468c5762aba53382b /plugins | |
parent | bc06262ce753ef2dab7ca080aff770730146b7ce (diff) |
Changes for Axis.Identifier changes. This includes renaming Axis to Component, and creating the Identifier objects for Key Axis and Button.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@85 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins')
19 files changed, 378 insertions, 587 deletions
diff --git a/plugins/DX8/build.xml b/plugins/DX8/build.xml index 0a4759b..ef20e6f 100644 --- a/plugins/DX8/build.xml +++ b/plugins/DX8/build.xml @@ -96,7 +96,7 @@ <delete file="bin/dxinput.jar" failonerror="no"/> <delete file="bin/dxinput.dll" failonerror="no"/> <delete file="../../coreAPI/src/tests/controller/dxinput.jar" failonerror="no" /> - <delete file="../../coreAPI/src/test/controller/dxinput.dll" failonerror="no"/> + <delete file="../../coreAPI/src/tests/controller/dxinput.dll" failonerror="no"/> <delete dir="../../docs/input/win32/apidoc" failonerror="no"/> </target> diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java b/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java index e9cfc6e..a09267d 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java @@ -38,15 +38,15 @@ *****************************************************************************/ package net.java.games.input; -import net.java.games.input.AbstractAxis; -import net.java.games.input.Axis; +import net.java.games.input.AbstractComponent; +import net.java.games.input.Component; /** * * @author martak * @version */ -class DirectInputAxis extends AbstractAxis { +class DirectInputAxis extends AbstractComponent { /** * DIDFT_ constants and macros defined in dinput.h @@ -106,31 +106,31 @@ class DirectInputAxis extends AbstractAxis { private int bitmask = 0xffffffff; private int bitshift = 0; - private DirectInputAxis(DirectInputDevice device, Axis.Identifier id, + private DirectInputAxis(DirectInputDevice device, Component.Identifier id, int didft, String name) { super(name, id); this.device = device; this.type = DIDFT_GETTYPE(didft); this.instance = DIDFT_GETINSTANCE(didft); - if (id == Axis.Identifier.X) { + if (id == Component.Identifier.Axis.X) { offset = 0; - } else if (id == Axis.Identifier.Y) { + } else if (id == Component.Identifier.Axis.Y) { offset = 1; - } else if (id == Axis.Identifier.Z) { + } else if (id == Component.Identifier.Axis.Z) { offset = 2; - } else if (id == Axis.Identifier.RX) { + } else if (id == Component.Identifier.Axis.RX) { offset = 3; - } else if (id == Axis.Identifier.RY) { + } else if (id == Component.Identifier.Axis.RY) { offset = 4; - } else if (id == Axis.Identifier.RZ) { + } else if (id == Component.Identifier.Axis.RZ) { offset = 5; - } else if (id == Axis.Identifier.SLIDER) { + } else if (id == Component.Identifier.Axis.SLIDER) { //System.out.println("Slider on "+name+" instance = "+instance); offset = 6 + (instance>>2); - } else if (id == Axis.Identifier.POV) { + } else if (id == Component.Identifier.Axis.POV) { //System.out.println("POV on "+name+" instance = "+instance); offset = 8 + instance; - } else if (id == Axis.Identifier.BUTTON) { + } else if (id instanceof Component.Identifier.Button) { //System.out.println("Button on "+name+" instance = "+instance); offset = 12 + (instance/4); bitshift = (instance%4)*8; @@ -152,26 +152,26 @@ class DirectInputAxis extends AbstractAxis { return ((float)data)/32768; } else if ((type&DIDFT_POV)!=0) { if (data == -1) { - return Axis.POV.OFF; + return Component.POV.OFF; } else if (data == 0.0) { - return Axis.POV.UP; + return Component.POV.UP; } else if (data == 4500) { - return Axis.POV.UP_RIGHT; + return Component.POV.UP_RIGHT; } else if (data == 9000) { - return Axis.POV.RIGHT; + return Component.POV.RIGHT; } else if (data == 13500) { - return Axis.POV.DOWN_RIGHT; + return Component.POV.DOWN_RIGHT; } else if (data == 18000) { - return Axis.POV.DOWN; + return Component.POV.DOWN; } else if (data == 22500) { - return Axis.POV.DOWN_LEFT; + return Component.POV.DOWN_LEFT; } else if (data == 27000) { - return Axis.POV.LEFT; + return Component.POV.LEFT; } else if (data == 31500) { - return Axis.POV.UP_LEFT; + return Component.POV.UP_LEFT; } else { System.err.print("Unexpected value for DX8 HAT: "+data); - return Axis.POV.OFF; + return Component.POV.OFF; } } else { // return raw value return (float)data; @@ -213,7 +213,7 @@ class DirectInputAxis extends AbstractAxis { * @param id The identifier for the device */ public static DirectInputAxis createAxis(DirectInputDevice device, - Axis.Identifier id, int didft, String name) { + Component.Identifier id, int didft, String name) { return new DirectInputAxis(device, id, didft, name); } } diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java b/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java index d269961..849a5f1 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java @@ -39,8 +39,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 net.java.games.input.Component; import java.util.ArrayList; import java.util.Iterator; @@ -120,21 +119,21 @@ class DirectInputDevice extends AbstractController { default: type = Type.STICK; break; } - axes = initDirectInputAxes(); + components = initDirectInputAxes(); } /** * Used instead of overriding initAxes because it needs the * pointer to the IDirectInputDevice */ - private Axis[] initDirectInputAxes() { + private Component[] initDirectInputAxes() { ArrayList list = new ArrayList(); enumObjects(lpDevice, list); - Axis[] ret = new Axis[list.size()]; + Component[] ret = new Component[list.size()]; Iterator it = list.iterator(); int i = 0; while (it.hasNext()) { - ret[i] = (Axis)it.next(); + ret[i] = (Component)it.next(); i++; } return ret; @@ -148,7 +147,7 @@ class DirectInputDevice extends AbstractController { * instance number of the axis. * @param name The name to call the axis. */ - private void addAxis(ArrayList list, Axis.Identifier id, int didft, + private void addAxis(ArrayList list, Component.Identifier id, int didft, String name) { list.add(DirectInputAxis.createAxis(this, id, didft, name)); } @@ -159,7 +158,7 @@ class DirectInputDevice extends AbstractController { * @param effect the natie effect id * @param axisID The axis ID */ - private void addRumbler(long effect, Axis.Identifier axisID, String axisName) { + private void addRumbler(long effect, Component.Identifier axisID, String axisName) { rumblerList.add(new DirectInputRumbler(this, effect, axisID, axisName)); } diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java b/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java index fcaa278..4b3c95d 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java @@ -38,7 +38,6 @@ *****************************************************************************/ package net.java.games.input; -import java.security.AccessController; import java.util.ArrayList; import java.util.Iterator; import net.java.games.input.Controller; @@ -59,7 +58,9 @@ public class DirectInputEnvironmentPlugin extends ControllerEnvironment java.security.AccessController.doPrivileged( new LoadLibraryAction("jinput")); */ - System.loadLibrary("dxinput"); + if(isSupported()) { + System.loadLibrary("dxinput"); + } } /** @@ -109,8 +110,22 @@ public class DirectInputEnvironmentPlugin extends ControllerEnvironment /** Creates new DirectInputEnvironment */ public DirectInputEnvironmentPlugin() { - lpDirectInput = directInputCreate(); - enumControllers(); + if(isSupported()) { + lpDirectInput = directInputCreate(); + enumControllers(); + } else { + controllers = new Controller[0]; + } + } + + public static boolean isSupported() { + System.out.println("OS name is: " + System.getProperty("os.name")); + if(System.getProperty("os.name").indexOf("Windows")!=-1) { + System.out.println("DX8 plugin is supported"); + return true; + } + System.out.println("DX8 plugin is not supported"); + return false; } /** Returns a list of all controllers available to this environment, diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java b/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java index 6faf163..9b5833c 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java @@ -38,8 +38,8 @@ *****************************************************************************/ package net.java.games.input; -import net.java.games.input.AbstractAxis; -import net.java.games.input.Axis; +import net.java.games.input.AbstractComponent; +import net.java.games.input.Component; import net.java.games.input.StandardKeyboard; /** @@ -143,8 +143,8 @@ class DirectInputKeyboard extends StandardKeyboard { for (; CROSSTABLE[keyIndex] > index; keyIndex--) ; if (CROSSTABLE[keyIndex] == index) { - Axis[] axes = getAxes(); - AbstractAxis key = (AbstractAxis)axes[index]; + Component[] components = getComponents(); + AbstractComponent key = (AbstractComponent)components[index]; if (name != null && name.length() > 0) { //System.out.println("Renaming key " + key.getName() + // " to " + name + " index=" + @@ -173,7 +173,7 @@ class DirectInputKeyboard extends StandardKeyboard { * @return true if this key has changed state since last read of its state, false otherwise. */ protected boolean isKeyPressed(Key key) { - KeyID id = (KeyID)key.getIdentifier(); + Component.Identifier.Key id = (Component.Identifier.Key)key.getIdentifier(); int keyIndex = id.getKeyIndex(); int crossIndex = CROSSTABLE[keyIndex]; return ((keyData[crossIndex] & 0x80) != 0); diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java b/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java index 7241414..4d9e257 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java @@ -38,8 +38,8 @@ *****************************************************************************/ package net.java.games.input; -import net.java.games.input.AbstractAxis; -import net.java.games.input.Axis; +import net.java.games.input.AbstractComponent; +import net.java.games.input.Component; import net.java.games.input.Mouse; /** @@ -105,12 +105,12 @@ class DirectInputMouse extends Mouse { /** * Callback to rename a given axis by type, name */ - private void renameAxis(Axis.Identifier id, String name) { - AbstractAxis axis; - if (id instanceof ButtonID) { - axis = (AbstractAxis)getButtons().getAxis(id); + private void renameAxis(Component.Identifier id, String name) { + AbstractComponent axis; + if (id instanceof Component.Identifier.Button) { + axis = (AbstractComponent)getButtons().getComponent(id); } else { - axis = (AbstractAxis)getBall().getAxis(id); + axis = (AbstractComponent)getBall().getComponent(id); } axis.setName(name); //System.out.println("Renaming " + name); @@ -160,10 +160,10 @@ class DirectInputMouse extends Mouse { public BallImpl() { super(DirectInputMouse.this.getName() + " ball"); numAxes = getNumAxes(lpDevice); - x = new BallAxis(Axis.Identifier.X); - y = new BallAxis(Axis.Identifier.Y); + x = new BallAxis(Component.Identifier.Axis.X); + y = new BallAxis(Component.Identifier.Axis.Y); if(numAxes > 2) { - wheel = new BallAxis(Axis.Identifier.SLIDER); + wheel = new BallAxis(Component.Identifier.Axis.SLIDER); } } } // class DirectInputMouse.BallImpl @@ -181,22 +181,22 @@ class DirectInputMouse extends Mouse { public ButtonsImpl() { super(DirectInputMouse.this.getName() + " buttons"); numButtons = getNumButtons(lpDevice); - left = new ButtonImpl(ButtonID.LEFT); - right = new ButtonImpl(ButtonID.RIGHT); + left = new ButtonImpl(Component.Identifier.Button.LEFT); + right = new ButtonImpl(Component.Identifier.Button.RIGHT); if(numButtons>2) { - middle = new ButtonImpl(ButtonID.MIDDLE); + middle = new ButtonImpl(Component.Identifier.Button.MIDDLE); } if(numButtons>3) { - side = new ButtonImpl(ButtonID.SIDE); + side = new ButtonImpl(Component.Identifier.Button.SIDE); } if(numButtons>4) { - extra = new ButtonImpl(ButtonID.EXTRA); + extra = new ButtonImpl(Component.Identifier.Button.EXTRA); } if(numButtons>5) { - forward = new ButtonImpl(ButtonID.FORWARD); + forward = new ButtonImpl(Component.Identifier.Button.FORWARD); } if(numButtons>6) { - back = new ButtonImpl(ButtonID.BACK); + back = new ButtonImpl(Component.Identifier.Button.BACK); } } } // class DirectInputMouse.ButtonsImpl @@ -235,21 +235,21 @@ class DirectInputMouse extends Mouse { * @param id An ID of a button to create an obejct to represent. * */ - public ButtonImpl(ButtonID id) { + public ButtonImpl(Component.Identifier.Button id) { super(id.getName(), id); - if (id == ButtonID.LEFT) { + if (id == Component.Identifier.Button.LEFT) { index = 12; - } else if (id == ButtonID.RIGHT) { + } else if (id == Component.Identifier.Button.RIGHT) { index = 13; - } else if (id == ButtonID.MIDDLE) { + } else if (id == Component.Identifier.Button.MIDDLE) { index = 14; - } else if (id == ButtonID.SIDE) { + } else if (id == Component.Identifier.Button.SIDE) { index = 15; - } else if (id == ButtonID.EXTRA) { + } else if (id == Component.Identifier.Button.EXTRA) { index = 16; - } else if (id == ButtonID.FORWARD) { + } else if (id == Component.Identifier.Button.FORWARD) { index = 17; - } else if (id == ButtonID.BACK) { + } else if (id == Component.Identifier.Button.BACK) { index = 18; } else { throw new RuntimeException("Unknown button"); @@ -287,7 +287,7 @@ class DirectInputMouse extends Mouse { /** * Mouse ball axis implementation */ - class BallAxis extends AbstractAxis { + class BallAxis extends AbstractComponent { /** * Starting index into the mouseData array @@ -299,11 +299,11 @@ class DirectInputMouse extends Mouse { */ public BallAxis(Identifier id) { super(id.getName(), id); - if (id == Identifier.X) { + if (id == Identifier.Axis.X) { index = 0; - } else if (id == Identifier.Y) { + } else if (id == Identifier.Axis.Y) { index = 4; - } else if (id == Identifier.SLIDER) { + } else if (id == Identifier.Axis.SLIDER) { index = 8; } else { throw new RuntimeException("Unknown mouse axis"); diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java b/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java index 444bf02..5c02b24 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java @@ -37,7 +37,7 @@ public class DirectInputRumbler implements Rumbler { /** The native effect */ private long effect; /** The identifier of the axis we are attached too */ - private Axis.Identifier axisID; + private Component.Identifier axisID; /** The name of the axis this rumbler is attached too */ private String axisName; @@ -49,7 +49,7 @@ public class DirectInputRumbler implements Rumbler { * @param axisID The id of the axis this rumbler is attached too * @param axisName The name of the axis this rumbler is attached too */ - public DirectInputRumbler(DirectInputDevice device, long effect, Axis.Identifier axisID, String axisName) { + public DirectInputRumbler(DirectInputDevice device, long effect, Component.Identifier axisID, String axisName) { this.device = device; this.effect = effect; this.axisID = axisID; @@ -61,7 +61,7 @@ public class DirectInputRumbler implements Rumbler { * * @return The axis id */ - public Axis.Identifier getAxisIdentifier() { + public Component.Identifier getAxisIdentifier() { return axisID; } diff --git a/plugins/DX8/src/native/input.cpp b/plugins/DX8/src/native/input.cpp index c4eb7af..188c439 100644 --- a/plugins/DX8/src/native/input.cpp +++ b/plugins/DX8/src/native/input.cpp @@ -49,8 +49,8 @@ jfieldID FID_Side = NULL; jfieldID FID_Forward = NULL; jfieldID FID_Back = NULL; -const char* FD_AxisIdentifier = "Lnet/java/games/input/Axis$Identifier;"; -const char* FD_ButtonIdentifier = "Lnet/java/games/input/Mouse$ButtonID;"; +const char* FD_AxisIdentifier = "Lnet/java/games/input/Component$Identifier$Axis;"; +const char* FD_ButtonIdentifier = "Lnet/java/games/input/Component$Identifier$Button;"; // Dummy input window. This is needed because DirectX evidently needs a window // to do anything, such as setting the cooperative level for a device. const TCHAR* DUMMY_WINDOW_NAME = "InputControllerWindow"; @@ -151,7 +151,7 @@ break; */ BOOL InitIDs(JNIEnv* env) { CLASS_AxisIdentifier = - env->FindClass("net/java/games/input/Axis$Identifier"); + env->FindClass("net/java/games/input/Component$Identifier$Axis"); if (CLASS_AxisIdentifier == NULL) { return FALSE; } @@ -190,18 +190,18 @@ BOOL InitIDs(JNIEnv* env) { if (FID_Slider == NULL) { return FALSE; } - FID_Button = env->GetStaticFieldID(CLASS_AxisIdentifier, "BUTTON", +/* FID_Button = env->GetStaticFieldID(CLASS_AxisIdentifier, "BUTTON", FD_AxisIdentifier); if (FID_Button == NULL) { return FALSE; - } + }*/ FID_POV = env->GetStaticFieldID(CLASS_AxisIdentifier, "POV", FD_AxisIdentifier); if (FID_POV == NULL) { return FALSE; } CLASS_ButtonIdentifier = - env->FindClass("net/java/games/input/Mouse$ButtonID"); + env->FindClass("net/java/games/input/Component$Identifier$Button"); if (CLASS_ButtonIdentifier == NULL) { return FALSE; } @@ -258,12 +258,12 @@ BOOL InitIDs(JNIEnv* env) { return FALSE; } MID_AddAxis = env->GetMethodID(CLASS_DirectInputDevice, "addAxis", - "(Ljava/util/ArrayList;Lnet/java/games/input/Axis$Identifier;ILjava/lang/String;)V"); + "(Ljava/util/ArrayList;Lnet/java/games/input/Component$Identifier;ILjava/lang/String;)V"); if (MID_AddAxis == NULL) { return FALSE; } MID_AddRumbler = env->GetMethodID(CLASS_DirectInputDevice, "addRumbler", - "(JLnet/java/games/input/Axis$Identifier;Ljava/lang/String;)V"); + "(JLnet/java/games/input/Component$Identifier;Ljava/lang/String;)V"); if (MID_AddRumbler == NULL) { return FALSE; } @@ -283,7 +283,7 @@ BOOL InitIDs(JNIEnv* env) { return FALSE; } MID_RenameAxis = env->GetMethodID(CLASS_DirectInputMouse, "renameAxis", - "(Lnet/java/games/input/Axis$Identifier;Ljava/lang/String;)V"); + "(Lnet/java/games/input/Component$Identifier;Ljava/lang/String;)V"); if (MID_RenameAxis == NULL) { return FALSE; } diff --git a/plugins/awt/src/net/java/games/input/AWTAxis.java b/plugins/awt/src/net/java/games/input/AWTAxis.java index 62b049b..daa2e12 100644 --- a/plugins/awt/src/net/java/games/input/AWTAxis.java +++ b/plugins/awt/src/net/java/games/input/AWTAxis.java @@ -25,8 +25,6 @@ */ package net.java.games.input; -import net.java.games.input.Component.Identifier; - /** * @author Jeremy * diff --git a/plugins/awt/src/net/java/games/input/AWTButton.java b/plugins/awt/src/net/java/games/input/AWTButton.java index 8ccf984..6e36d16 100644 --- a/plugins/awt/src/net/java/games/input/AWTButton.java +++ b/plugins/awt/src/net/java/games/input/AWTButton.java @@ -25,8 +25,6 @@ */ package net.java.games.input; -import net.java.games.input.Component.Identifier; - /** * @author Jeremy * diff --git a/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java b/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java index 8faac5c..a155db5 100644 --- a/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java +++ b/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java @@ -25,9 +25,6 @@ */ package net.java.games.input; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - import net.java.games.input.Controller; import net.java.games.input.ControllerEnvironment; import net.java.games.util.plugins.Plugin; diff --git a/plugins/awt/src/net/java/games/input/AWTKeyboard.java b/plugins/awt/src/net/java/games/input/AWTKeyboard.java index d98c90d..dba9b0e 100644 --- a/plugins/awt/src/net/java/games/input/AWTKeyboard.java +++ b/plugins/awt/src/net/java/games/input/AWTKeyboard.java @@ -30,8 +30,6 @@ import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.KeyEvent; -import net.java.games.input.Keyboard.Key; - /** * @author Jeremy * @@ -50,7 +48,7 @@ public class AWTKeyboard extends StandardKeyboard implements AWTEventListener { protected AWTKeyboard(String name) { super(name); - buttonValues = new boolean[getAxes().length]; + buttonValues = new boolean[getComponents().length]; buttonMap = new int[65535]; //has to be this big, as the values of KeyEvent keys are large buttonMap[KeyEvent.VK_0] = Component.Identifier.Key._0.getKeyIndex(); diff --git a/plugins/awt/src/net/java/games/input/AWTMouse.java b/plugins/awt/src/net/java/games/input/AWTMouse.java index bbae94b..ed76ed6 100644 --- a/plugins/awt/src/net/java/games/input/AWTMouse.java +++ b/plugins/awt/src/net/java/games/input/AWTMouse.java @@ -31,7 +31,6 @@ import java.awt.Point; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseWheelEvent; /** diff --git a/plugins/linux/src/java/net/java/games/input/LinuxAxis.java b/plugins/linux/src/java/net/java/games/input/LinuxAxis.java index 28cb9d9..21f3bc5 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxAxis.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxAxis.java @@ -26,14 +26,14 @@ package net.java.games.input; -import net.java.games.input.AbstractAxis; +import net.java.games.input.AbstractComponent; import net.java.games.input.LinuxDevice; /** Represents an Axis absolute or relative * * @author Jeremy Booth ([email protected]) */ -public class LinuxAxis extends AbstractAxis { +public class LinuxAxis extends AbstractComponent { /** The controller this axis is part of */ private LinuxDevice controller; 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 5e4be01..6ccd4e7 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java @@ -173,7 +173,7 @@ public class LinuxDevice extends AbstractController { axesArray.add(buttons[i]); } } - axes = (Axis[]) axesArray.toArray(axes); + components = (Component[]) axesArray.toArray(components); guessType(); } @@ -417,11 +417,11 @@ public class LinuxDevice extends AbstractController { * @return The new button */ private LinuxAxis createButton(int buttonNumber, int nativeButtonType) { - Axis.Identifier id = LinuxNativeTypesMap.getButtonID(nativeButtonType); + Component.Identifier id = LinuxNativeTypesMap.getButtonID(nativeButtonType); String name = LinuxNativeTypesMap.getButtonName(nativeButtonType); if(name == null) { name = "Uknown button"; - id = new ButtonID(name); + id = Component.Identifier.Button.UNKNOWN; } return new LinuxAxis(this, buttonNumber, name, id, 0, false, true, false); @@ -433,7 +433,7 @@ public class LinuxDevice extends AbstractController { * @return The new axis */ private LinuxAxis createRelAxis(int axisNumber, int nativeType) { - Axis.Identifier id = LinuxNativeTypesMap.getRelAxisID(nativeType); + Component.Identifier id = LinuxNativeTypesMap.getRelAxisID(nativeType); String name = LinuxNativeTypesMap.getRelAxisName(nativeType); // This is done to be like the windows version @@ -449,15 +449,15 @@ public class LinuxDevice extends AbstractController { * @return The new axis */ private LinuxAxis createAbsAxis(int axisNumber, int nativeType) { - Axis.Identifier id = LinuxNativeTypesMap.getAbsAxisID(nativeType); + Component.Identifier id = LinuxNativeTypesMap.getAbsAxisID(nativeType); String name = LinuxNativeTypesMap.getAbsAxisName(nativeType); // Work around for a kernel level (I think) bug that incorrectly reports // the third axis as a rudder not a throttle on analog (gameport) 3 axis // 4 button sticks if((getName().equals("Analog 3-axis 4-button joystick")) && (portType == Controller.PortType.GAME)) { - if((id == Axis.Identifier.RZ) && (name.equals("Rudder"))) { - id = Axis.Identifier.SLIDER; + if((id == Component.Identifier.Axis.RZ) && (name.equals("Rudder"))) { + id = Component.Identifier.Axis.SLIDER; name = "Throttle"; } } @@ -616,7 +616,7 @@ public class LinuxDevice extends AbstractController { * A device that represents a joystick coolie hat. * @author Jeremy Booth ([email protected]) */ - public static class LinuxHat extends AbstractAxis { + public static class LinuxHat extends AbstractComponent { /** The parent controller */ @@ -644,7 +644,7 @@ public class LinuxDevice extends AbstractController { * @param yAxisID The Y axis native axis ID */ public LinuxHat(LinuxDevice controller, String name, int xAxisID, int yAxisID) { - super(name, Axis.Identifier.POV); + super(name, Component.Identifier.Axis.POV); System.out.println("Creating a Hat for device " + controller.getName() + " named " + name + " from axis " + xAxisID + " and " + yAxisID); @@ -729,211 +729,4 @@ public class LinuxDevice extends AbstractController { } - /** Some button ID's specific to linux devices - * @author Jeremy Booth ([email protected]) - */ - public static class ButtonID extends Axis.Identifier { - - /** First device button - */ - public static final ButtonID BTN_0 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_0)); - - /** Second device button - */ - public static final ButtonID BTN_1 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_1)); - - /** Thrid device button - */ - public static final ButtonID BTN_2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_2)); - - /** Fourth device button - */ - public static final ButtonID BTN_3 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_3)); - - /** Fifth device button - */ - public static final ButtonID BTN_4 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_4)); - - /** Sixth device button - */ - public static final ButtonID BTN_5 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_5)); - - /** Seventh device button - */ - public static final ButtonID BTN_6 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_6)); - - /** Eighth (had to check that spelling on dictionary.com) device button - */ - public static final ButtonID BTN_7 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_7)); - - /** Ninth device button - */ - public static final ButtonID BTN_8 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_8)); - - /** 10th device button - */ - public static final ButtonID BTN_9 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_9)); - - /** Joystick trigger button - */ - public static final ButtonID BTN_TRIGGER = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TRIGGER)); - - /** Joystick thumb button - */ - public static final ButtonID BTN_THUMB = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMB)); - - /** Second joystick thumb button - */ - public static final ButtonID BTN_THUMB2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMB2)); - - /** Joystick top button - */ - public static final ButtonID BTN_TOP = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOP)); - - /** Second joystick top button - */ - public static final ButtonID BTN_TOP2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOP2)); - - /** The joystick button you play with with you little finger (Pinkie on *that* side - * of the pond :P) - */ - public static final ButtonID BTN_PINKIE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_PINKIE)); - - /** Joystick button on the base of the device - */ - public static final ButtonID BTN_BASE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE)); - - /** Second joystick button on the base of the device - */ - public static final ButtonID BTN_BASE2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE2)); - - /** Thrid joystick button on the base of the device - */ - public static final ButtonID BTN_BASE3 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE3)); - - /** Fourth joystick button on the base of the device - */ - public static final ButtonID BTN_BASE4 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE4)); - - /** Fifth joystick button on the base of the device - */ - public static final ButtonID BTN_BASE5 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE5)); - - /** Sixth joystick button on the base of the device - */ - public static final ButtonID BTN_BASE6 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE6)); - - /** erm, dunno, but it's in the defines so it might exist. - */ - public static final ButtonID BTN_DEAD = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_DEAD)); - - /** 'A' button on a gamepad - */ - public static final ButtonID BTN_A = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_A)); - - /** 'B' button on a gamepad - */ - public static final ButtonID BTN_B = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_B)); - - /** 'C' button on a gamepad - */ - public static final ButtonID BTN_C = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_C)); - - /** 'X' button on a gamepad - */ - public static final ButtonID BTN_X = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_X)); - - /** 'Y' button on a gamepad - */ - public static final ButtonID BTN_Y = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_Y)); - - /** 'Z' button on a gamepad - */ - public static final ButtonID BTN_Z = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_Z)); - - /** Left thumb button on a gamepad - */ - public static final ButtonID BTN_TL = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TL)); - - /** Right thumb button on a gamepad - */ - public static final ButtonID BTN_TR = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TR)); - - /** Second left thumb button on a gamepad - */ - public static final ButtonID BTN_TL2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TL2)); - - /** Second right thumb button on a gamepad - */ - public static final ButtonID BTN_TR2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TR2)); - - /** 'Select' button on a gamepad - */ - public static final ButtonID BTN_SELECT = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_SELECT)); - - /** 'Mode' button on a gamepad - */ - public static final ButtonID BTN_MODE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_MODE)); - - /** Another left thumb button on a gamepad (how many thumbs do you have??) - */ - public static final ButtonID BTN_THUMBL = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMBL)); - - /** Another right thumb button on a gamepad - */ - public static final ButtonID BTN_THUMBR = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMBR)); - - /** Digitiser pen tool button - */ - public static final ButtonID BTN_TOOL_PEN = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_PEN)); - - /** Digitiser rubber (eraser) tool button - */ - public static final ButtonID BTN_TOOL_RUBBER = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_RUBBER)); - - /** Digitiser brush tool button - */ - public static final ButtonID BTN_TOOL_BRUSH = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_BRUSH)); - - /** Digitiser pencil tool button - */ - public static final ButtonID BTN_TOOL_PENCIL = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_PENCIL)); - - /** Digitiser airbrush tool button - */ - public static final ButtonID BTN_TOOL_AIRBRUSH = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_AIRBRUSH)); - - /** Digitiser finger tool button - */ - public static final ButtonID BTN_TOOL_FINGER = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_FINGER)); - - /** Digitiser mouse tool button - */ - public static final ButtonID BTN_TOOL_MOUSE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_MOUSE)); - - /** Digitiser lens tool button - */ - public static final ButtonID BTN_TOOL_LENS = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_LENS)); - - /** Digitiser touch button - */ - public static final ButtonID BTN_TOUCH = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOUCH)); - - /** Digitiser stylus button - */ - public static final ButtonID BTN_STYLUS = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_STYLUS)); - - /** Second digitiser stylus button - */ - public static final ButtonID BTN_STYLUS2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_STYLUS2)); - - /** Create a new Button.Identidier with the passed name - * @param name The name for the new identifier - */ - private ButtonID(String name) { - super(name); - } - - } - } 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 da60789..1747ca3 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java @@ -33,8 +33,10 @@ import net.java.games.util.plugins.Plugin; public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plugin { static { - System.loadLibrary("jinput"); - } + if(isSupported()) { + System.loadLibrary("jinput"); + } + } /** List of controllers */ @@ -42,9 +44,23 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu /** Creates a new instance of LinuxEnvironmentPlugin */ public LinuxEnvironmentPlugin() { - LinuxNativeTypesMap.init(); - init(); - createControllers(); + if(isSupported()) { + LinuxNativeTypesMap.init(); + init(); + createControllers(); + } else { + controllers = new Controller[0]; + } + } + + public static boolean isSupported() { + System.out.println("OS name is: " + System.getProperty("os.name")); + if(System.getProperty("os.name").indexOf("Linux")!=-1) { + System.out.println("Linux plugin is supported"); + return true; + } + System.out.println("Linux plugin is not supported"); + return false; } /** Returns a list of all controllers available to this environment, @@ -61,10 +77,24 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu private void createControllers() { int numDevices = getNumberOfDevices(); - controllers = new Controller[numDevices]; + Controller[] tempControllers = new Controller[numDevices]; + int numRealDevices = 0; + Controller tempController; for(int i=0;i<numDevices;i++) { - controllers[i] = createDevice(i); + tempController = createDevice(i); + if(tempController!=null) { + if(tempController.getComponents().length>0 || tempController.getControllers().length>0) { + tempControllers[numRealDevices] = tempController; + numRealDevices++; + } + } + } + + controllers = new Controller[numRealDevices]; + + for(int i=0;i<numRealDevices;i++) { + controllers[i] = tempControllers[i]; } } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java b/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java index 9fbb2d6..f6533bd 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java @@ -104,7 +104,7 @@ public class LinuxKeyboard extends StandardKeyboard { System.out.println("id for supportedKeys index is " + LinuxNativeTypesMap.getButtonID(supportedKeys[keyMap[((Keyboard.KeyID) key.getIdentifier()).getKeyIndex()]])); System.out.flush(); }*/ - if(keyData[keyMap[((Keyboard.KeyID) key.getIdentifier()).getKeyIndex()]] > 0) { + if(keyData[keyMap[((Component.Identifier.Key) key.getIdentifier()).getKeyIndex()]] > 0) { return true; } return false; @@ -123,14 +123,14 @@ public class LinuxKeyboard extends StandardKeyboard { /** Goes through every key to initialise the key map */ private void setupKeyMap() { - for(int i=0;i<KeyID.LAST.getKeyIndex();i++) { + for(int i=0;i<Component.Identifier.Key.LAST.getKeyIndex();i++) { keyMap[i] = numKeys; } for(int i=0;i<numKeys;i++) { int tempNativeID = supportedKeys[i]; - Keyboard.KeyID tempKeyID = StandardKeyboard.KeyID.VOID; + Component.Identifier.Key tempKeyID = Component.Identifier.Key.VOID; try { - tempKeyID = (Keyboard.KeyID)LinuxNativeTypesMap.getButtonID(tempNativeID); + tempKeyID = (Component.Identifier.Key)LinuxNativeTypesMap.getButtonID(tempNativeID); } catch (ClassCastException e) { System.out.println("LinuxNativeTypesMap.getButtonID() returned " + LinuxNativeTypesMap.getButtonID(tempNativeID).getClass().toString()); } @@ -146,16 +146,16 @@ public class LinuxKeyboard extends StandardKeyboard { /** Renames all the keys based on what information we have about them (number/name) */ private void renameKeys() { - Axis tempAxes[] = getAxes(); + Component tempAxes[] = getComponents(); // Do this one by hand as it's a special case //((AbstractAxis)tempAxes[0]).setName("Unknown"); for(int i=0;i<tempAxes.length;i++) { - Axis tempAxis = tempAxes[i]; - int nativeKeyID = supportedKeys[keyMap[((Keyboard.KeyID) tempAxis.getIdentifier()).getKeyIndex()]]; + Component tempAxis = tempAxes[i]; + int nativeKeyID = supportedKeys[keyMap[((Component.Identifier.Key) tempAxis.getIdentifier()).getKeyIndex()]]; //System.out.println("key " + tempAxis + " map: " + nativeKeyID); if(nativeKeyID != NativeDefinitions.KEY_UNKNOWN) { String tempName = LinuxNativeTypesMap.getButtonName(nativeKeyID); - ((AbstractAxis)tempAxis).setName(tempName); + ((AbstractComponent)tempAxis).setName(tempName); /*System.out.println("axis id is " + (Keyboard.KeyID) tempAxis.getIdentifier()); System.out.println("keyMap[id] is " + keyMap[((Keyboard.KeyID) tempAxis.getIdentifier()).getKeyIndex()]); @@ -189,41 +189,5 @@ public class LinuxKeyboard extends StandardKeyboard { * @param deviceID The keybaord id * @return native port ype */ - private native int getNativePortType(int deviceID); - - /** Linux specific key ID's - * @author Jeremy Booth ([email protected]) - */ - public static class KeyID extends StandardKeyboard.KeyID { - - /** The Page up key id - */ - public static final KeyID PAGEUP = new KeyID(StandardKeyboard.KeyID.LAST.getKeyIndex()+1, "Page up"); - /** Page down key id - */ - public static final KeyID PAGEDOWN = new KeyID(StandardKeyboard.KeyID.LAST.getKeyIndex()+1, "Page down"); - /** The last defined key ID - */ - protected static final KeyID LAST = PAGEDOWN; - - /** The name of this key ID - */ - String name; - - /** Construct a new key ID from the passed arguments - * @param keyid The native ID of the key - * @param name The name fo the key - */ - public KeyID(int keyid, String name) { - super(keyid); - this.name = name; - } - - /** Returns a string representing this key ID - * @return String representing this key id - */ - public String toString() { - return super.toString() + " (" + name + ")"; - } - } + private native int getNativePortType(int deviceID); } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxMouse.java b/plugins/linux/src/java/net/java/games/input/LinuxMouse.java index 3336905..b345b5e 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxMouse.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxMouse.java @@ -42,10 +42,10 @@ public class LinuxMouse extends Mouse { super(device.getName()); this.device = device; - Axis[] axes = device.getAxes(); - Axis x = null; - Axis y = null; - Axis wheel = null; + Component[] components = device.getComponents(); + Component x = null; + Component y = null; + Component wheel = null; Button left = null; Button right = null; Button middle = null; @@ -55,30 +55,30 @@ public class LinuxMouse extends Mouse { Button back = null; // start from the back, that way the first one is it - for(int i = (axes.length -1);i>=0;i--) { - Axis tempAxis = axes[i]; + for(int i = (components.length -1);i>=0;i--) { + Component tempAxis = components[i]; if(tempAxis.isRelative()) { - if(tempAxis.getIdentifier() == Axis.Identifier.X) { + if(tempAxis.getIdentifier() == Component.Identifier.Axis.X) { x = tempAxis; - } else if(tempAxis.getIdentifier() == Axis.Identifier.Y) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Axis.Y) { y = tempAxis; - } else if(tempAxis.getIdentifier() == Axis.Identifier.SLIDER) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Axis.SLIDER) { wheel = tempAxis; } } else if(!(tempAxis.isAnalog())) { - if(tempAxis.getIdentifier() == Mouse.ButtonID.LEFT) { + if(tempAxis.getIdentifier() == Component.Identifier.Button.LEFT) { left = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.RIGHT) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.RIGHT) { right = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.MIDDLE) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.MIDDLE) { middle = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.SIDE) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.SIDE) { side = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.EXTRA) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.EXTRA) { extra = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.FORWARD) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.FORWARD) { forward = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.BACK) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.BACK) { back = new LinuxMouseButton(tempAxis); } } @@ -104,7 +104,7 @@ public class LinuxMouse extends Mouse { * @param y The y axis * @param wheel The mouse wheel axis */ - public LinuxMouseBall(Axis x, Axis y, Axis wheel) { + public LinuxMouseBall(Component x, Component y, Component wheel) { super(LinuxMouse.this.getName() + " ball"); this.x = x; this.y = y; @@ -141,13 +141,13 @@ public class LinuxMouse extends Mouse { private class LinuxMouseButton extends Mouse.Button { /** The real Axis */ - private Axis realAxis; + private Component realAxis; /** Construct a linux mouse button fro mthe given axis * @param axis The axis that holds the data */ - public LinuxMouseButton(Axis axis) { - super(axis.getName(), (Mouse.ButtonID)axis.getIdentifier()); + public LinuxMouseButton(Component axis) { + super(axis.getName(), (Component.Identifier.Button)axis.getIdentifier()); this.realAxis = axis; } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java b/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java index 96a11e3..6fcf06b 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java @@ -47,13 +47,13 @@ public class LinuxNativeTypesMap { private String absAxesNames[]; /** Indexed array of relative axis ID's */ - private Axis.Identifier relAxesIDs[]; + private Component.Identifier relAxesIDs[]; /** Indexed array of absoulte axis ID's */ - private Axis.Identifier absAxesIDs[]; + private Component.Identifier absAxesIDs[]; /** Indexed array of button axis ID's */ - private Axis.Identifier buttonIDs[]; + private Component.Identifier buttonIDs[]; /** create an empty, uninitialsed map */ @@ -338,125 +338,125 @@ public class LinuxNativeTypesMap { keyNames[NativeDefinitions.BTN_STYLUS] = "Digitiser Stylus Button "; keyNames[NativeDefinitions.BTN_STYLUS2] = "Second Digitiser Stylus Button "; - buttonIDs = new Axis.Identifier[NativeDefinitions.KEY_MAX]; - buttonIDs[NativeDefinitions.KEY_ESC] = StandardKeyboard.KeyID.ESCAPE; - buttonIDs[NativeDefinitions.KEY_1] = StandardKeyboard.KeyID._1; - buttonIDs[NativeDefinitions.KEY_2] = StandardKeyboard.KeyID._2; - buttonIDs[NativeDefinitions.KEY_3] = StandardKeyboard.KeyID._3; - buttonIDs[NativeDefinitions.KEY_4] = StandardKeyboard.KeyID._4; - buttonIDs[NativeDefinitions.KEY_5] = StandardKeyboard.KeyID._5; - buttonIDs[NativeDefinitions.KEY_6] = StandardKeyboard.KeyID._6; - buttonIDs[NativeDefinitions.KEY_7] = StandardKeyboard.KeyID._7; - buttonIDs[NativeDefinitions.KEY_8] = StandardKeyboard.KeyID._8; - buttonIDs[NativeDefinitions.KEY_9] = StandardKeyboard.KeyID._9; - buttonIDs[NativeDefinitions.KEY_0] = StandardKeyboard.KeyID._0; - buttonIDs[NativeDefinitions.KEY_MINUS] = StandardKeyboard.KeyID.MINUS; - buttonIDs[NativeDefinitions.KEY_EQUAL] = StandardKeyboard.KeyID.EQUALS; - buttonIDs[NativeDefinitions.KEY_BACKSPACE] = StandardKeyboard.KeyID.BACK; - buttonIDs[NativeDefinitions.KEY_TAB] = StandardKeyboard.KeyID.TAB; - buttonIDs[NativeDefinitions.KEY_Q] = StandardKeyboard.KeyID.Q; - buttonIDs[NativeDefinitions.KEY_W] = StandardKeyboard.KeyID.W; - buttonIDs[NativeDefinitions.KEY_E] = StandardKeyboard.KeyID.E; - buttonIDs[NativeDefinitions.KEY_R] = StandardKeyboard.KeyID.R; - buttonIDs[NativeDefinitions.KEY_T] = StandardKeyboard.KeyID.T; - buttonIDs[NativeDefinitions.KEY_Y] = StandardKeyboard.KeyID.Y; - buttonIDs[NativeDefinitions.KEY_U] = StandardKeyboard.KeyID.U; - buttonIDs[NativeDefinitions.KEY_I] = StandardKeyboard.KeyID.I; - buttonIDs[NativeDefinitions.KEY_O] = StandardKeyboard.KeyID.O; - buttonIDs[NativeDefinitions.KEY_P] = StandardKeyboard.KeyID.P; - buttonIDs[NativeDefinitions.KEY_LEFTBRACE] = StandardKeyboard.KeyID.LBRACKET; - buttonIDs[NativeDefinitions.KEY_RIGHTBRACE] = StandardKeyboard.KeyID.RBRACKET; - buttonIDs[NativeDefinitions.KEY_ENTER] = StandardKeyboard.KeyID.RETURN; - buttonIDs[NativeDefinitions.KEY_LEFTCTRL] = StandardKeyboard.KeyID.LCONTROL; - buttonIDs[NativeDefinitions.KEY_A] = StandardKeyboard.KeyID.A; - buttonIDs[NativeDefinitions.KEY_S] = StandardKeyboard.KeyID.S; - buttonIDs[NativeDefinitions.KEY_D] = StandardKeyboard.KeyID.D; - buttonIDs[NativeDefinitions.KEY_F] = StandardKeyboard.KeyID.F; - buttonIDs[NativeDefinitions.KEY_G] = StandardKeyboard.KeyID.G; - buttonIDs[NativeDefinitions.KEY_H] = StandardKeyboard.KeyID.H; - buttonIDs[NativeDefinitions.KEY_J] = StandardKeyboard.KeyID.J; - buttonIDs[NativeDefinitions.KEY_K] = StandardKeyboard.KeyID.K; - buttonIDs[NativeDefinitions.KEY_L] = StandardKeyboard.KeyID.L; - buttonIDs[NativeDefinitions.KEY_SEMICOLON] = StandardKeyboard.KeyID.SEMICOLON; - buttonIDs[NativeDefinitions.KEY_APOSTROPHE] = StandardKeyboard.KeyID.APOSTROPHE; - buttonIDs[NativeDefinitions.KEY_GRAVE] = StandardKeyboard.KeyID.GRAVE; - buttonIDs[NativeDefinitions.KEY_LEFTSHIFT] = StandardKeyboard.KeyID.LSHIFT; - buttonIDs[NativeDefinitions.KEY_BACKSLASH] = StandardKeyboard.KeyID.BACKSLASH; - buttonIDs[NativeDefinitions.KEY_Z] = StandardKeyboard.KeyID.Z; - buttonIDs[NativeDefinitions.KEY_X] = StandardKeyboard.KeyID.X; - buttonIDs[NativeDefinitions.KEY_C] = StandardKeyboard.KeyID.C; - buttonIDs[NativeDefinitions.KEY_V] = StandardKeyboard.KeyID.V; - buttonIDs[NativeDefinitions.KEY_B] = StandardKeyboard.KeyID.B; - buttonIDs[NativeDefinitions.KEY_N] = StandardKeyboard.KeyID.N; - buttonIDs[NativeDefinitions.KEY_M] = StandardKeyboard.KeyID.M; - buttonIDs[NativeDefinitions.KEY_COMMA] = StandardKeyboard.KeyID.COMMA; - buttonIDs[NativeDefinitions.KEY_DOT] = StandardKeyboard.KeyID.PERIOD; - buttonIDs[NativeDefinitions.KEY_SLASH] = StandardKeyboard.KeyID.SLASH; - buttonIDs[NativeDefinitions.KEY_RIGHTSHIFT] = StandardKeyboard.KeyID.RSHIFT; - buttonIDs[NativeDefinitions.KEY_KPASTERISK] = StandardKeyboard.KeyID.MULTIPLY; - buttonIDs[NativeDefinitions.KEY_LEFTALT] = StandardKeyboard.KeyID.LALT; - buttonIDs[NativeDefinitions.KEY_SPACE] = StandardKeyboard.KeyID.SPACE; - buttonIDs[NativeDefinitions.KEY_CAPSLOCK] = StandardKeyboard.KeyID.CAPITAL; - buttonIDs[NativeDefinitions.KEY_F1] = StandardKeyboard.KeyID.F1; - buttonIDs[NativeDefinitions.KEY_F2] = StandardKeyboard.KeyID.F2; - buttonIDs[NativeDefinitions.KEY_F3] = StandardKeyboard.KeyID.F3; - buttonIDs[NativeDefinitions.KEY_F4] = StandardKeyboard.KeyID.F4; - buttonIDs[NativeDefinitions.KEY_F5] = StandardKeyboard.KeyID.F5; - buttonIDs[NativeDefinitions.KEY_F6] = StandardKeyboard.KeyID.F6; - buttonIDs[NativeDefinitions.KEY_F7] = StandardKeyboard.KeyID.F7; - buttonIDs[NativeDefinitions.KEY_F8] = StandardKeyboard.KeyID.F8; - buttonIDs[NativeDefinitions.KEY_F9] = StandardKeyboard.KeyID.F9; - buttonIDs[NativeDefinitions.KEY_F10] = StandardKeyboard.KeyID.F10; - buttonIDs[NativeDefinitions.KEY_NUMLOCK] = StandardKeyboard.KeyID.NUMLOCK; - buttonIDs[NativeDefinitions.KEY_SCROLLLOCK] = StandardKeyboard.KeyID.SCROLL; - buttonIDs[NativeDefinitions.KEY_KP7] = StandardKeyboard.KeyID.NUMPAD7; - buttonIDs[NativeDefinitions.KEY_KP8] = StandardKeyboard.KeyID.NUMPAD8; - buttonIDs[NativeDefinitions.KEY_KP9] = StandardKeyboard.KeyID.NUMPAD9; - buttonIDs[NativeDefinitions.KEY_KPMINUS] = StandardKeyboard.KeyID.SUBTRACT; - buttonIDs[NativeDefinitions.KEY_KP4] = StandardKeyboard.KeyID.NUMPAD4; - buttonIDs[NativeDefinitions.KEY_KP5] = StandardKeyboard.KeyID.NUMPAD5; - buttonIDs[NativeDefinitions.KEY_KP6] = StandardKeyboard.KeyID.NUMPAD6; - buttonIDs[NativeDefinitions.KEY_KPPLUS] = StandardKeyboard.KeyID.ADD; - buttonIDs[NativeDefinitions.KEY_KP1] = StandardKeyboard.KeyID.NUMPAD1; - buttonIDs[NativeDefinitions.KEY_KP2] = StandardKeyboard.KeyID.NUMPAD2; - buttonIDs[NativeDefinitions.KEY_KP3] = StandardKeyboard.KeyID.NUMPAD3; - buttonIDs[NativeDefinitions.KEY_KP0] = StandardKeyboard.KeyID.NUMPAD0; - buttonIDs[NativeDefinitions.KEY_KPDOT] = StandardKeyboard.KeyID.DECIMAL; + buttonIDs = new Component.Identifier[NativeDefinitions.KEY_MAX]; + buttonIDs[NativeDefinitions.KEY_ESC] = Component.Identifier.Key.ESCAPE; + buttonIDs[NativeDefinitions.KEY_1] = Component.Identifier.Key._1; + buttonIDs[NativeDefinitions.KEY_2] = Component.Identifier.Key._2; + buttonIDs[NativeDefinitions.KEY_3] = Component.Identifier.Key._3; + buttonIDs[NativeDefinitions.KEY_4] = Component.Identifier.Key._4; + buttonIDs[NativeDefinitions.KEY_5] = Component.Identifier.Key._5; + buttonIDs[NativeDefinitions.KEY_6] = Component.Identifier.Key._6; + buttonIDs[NativeDefinitions.KEY_7] = Component.Identifier.Key._7; + buttonIDs[NativeDefinitions.KEY_8] = Component.Identifier.Key._8; + buttonIDs[NativeDefinitions.KEY_9] = Component.Identifier.Key._9; + buttonIDs[NativeDefinitions.KEY_0] = Component.Identifier.Key._0; + buttonIDs[NativeDefinitions.KEY_MINUS] = Component.Identifier.Key.MINUS; + buttonIDs[NativeDefinitions.KEY_EQUAL] = Component.Identifier.Key.EQUALS; + buttonIDs[NativeDefinitions.KEY_BACKSPACE] = Component.Identifier.Key.BACK; + buttonIDs[NativeDefinitions.KEY_TAB] = Component.Identifier.Key.TAB; + buttonIDs[NativeDefinitions.KEY_Q] = Component.Identifier.Key.Q; + buttonIDs[NativeDefinitions.KEY_W] = Component.Identifier.Key.W; + buttonIDs[NativeDefinitions.KEY_E] = Component.Identifier.Key.E; + buttonIDs[NativeDefinitions.KEY_R] = Component.Identifier.Key.R; + buttonIDs[NativeDefinitions.KEY_T] = Component.Identifier.Key.T; + buttonIDs[NativeDefinitions.KEY_Y] = Component.Identifier.Key.Y; + buttonIDs[NativeDefinitions.KEY_U] = Component.Identifier.Key.U; + buttonIDs[NativeDefinitions.KEY_I] = Component.Identifier.Key.I; + buttonIDs[NativeDefinitions.KEY_O] = Component.Identifier.Key.O; + buttonIDs[NativeDefinitions.KEY_P] = Component.Identifier.Key.P; + buttonIDs[NativeDefinitions.KEY_LEFTBRACE] = Component.Identifier.Key.LBRACKET; + buttonIDs[NativeDefinitions.KEY_RIGHTBRACE] = Component.Identifier.Key.RBRACKET; + buttonIDs[NativeDefinitions.KEY_ENTER] = Component.Identifier.Key.RETURN; + buttonIDs[NativeDefinitions.KEY_LEFTCTRL] = Component.Identifier.Key.LCONTROL; + buttonIDs[NativeDefinitions.KEY_A] = Component.Identifier.Key.A; + buttonIDs[NativeDefinitions.KEY_S] = Component.Identifier.Key.S; + buttonIDs[NativeDefinitions.KEY_D] = Component.Identifier.Key.D; + buttonIDs[NativeDefinitions.KEY_F] = Component.Identifier.Key.F; + buttonIDs[NativeDefinitions.KEY_G] = Component.Identifier.Key.G; + buttonIDs[NativeDefinitions.KEY_H] = Component.Identifier.Key.H; + buttonIDs[NativeDefinitions.KEY_J] = Component.Identifier.Key.J; + buttonIDs[NativeDefinitions.KEY_K] = Component.Identifier.Key.K; + buttonIDs[NativeDefinitions.KEY_L] = Component.Identifier.Key.L; + buttonIDs[NativeDefinitions.KEY_SEMICOLON] = Component.Identifier.Key.SEMICOLON; + buttonIDs[NativeDefinitions.KEY_APOSTROPHE] = Component.Identifier.Key.APOSTROPHE; + buttonIDs[NativeDefinitions.KEY_GRAVE] = Component.Identifier.Key.GRAVE; + buttonIDs[NativeDefinitions.KEY_LEFTSHIFT] = Component.Identifier.Key.LSHIFT; + buttonIDs[NativeDefinitions.KEY_BACKSLASH] = Component.Identifier.Key.BACKSLASH; + buttonIDs[NativeDefinitions.KEY_Z] = Component.Identifier.Key.Z; + buttonIDs[NativeDefinitions.KEY_X] = Component.Identifier.Key.X; + buttonIDs[NativeDefinitions.KEY_C] = Component.Identifier.Key.C; + buttonIDs[NativeDefinitions.KEY_V] = Component.Identifier.Key.V; + buttonIDs[NativeDefinitions.KEY_B] = Component.Identifier.Key.B; + buttonIDs[NativeDefinitions.KEY_N] = Component.Identifier.Key.N; + buttonIDs[NativeDefinitions.KEY_M] = Component.Identifier.Key.M; + buttonIDs[NativeDefinitions.KEY_COMMA] = Component.Identifier.Key.COMMA; + buttonIDs[NativeDefinitions.KEY_DOT] = Component.Identifier.Key.PERIOD; + buttonIDs[NativeDefinitions.KEY_SLASH] = Component.Identifier.Key.SLASH; + buttonIDs[NativeDefinitions.KEY_RIGHTSHIFT] = Component.Identifier.Key.RSHIFT; + buttonIDs[NativeDefinitions.KEY_KPASTERISK] = Component.Identifier.Key.MULTIPLY; + buttonIDs[NativeDefinitions.KEY_LEFTALT] = Component.Identifier.Key.LALT; + buttonIDs[NativeDefinitions.KEY_SPACE] = Component.Identifier.Key.SPACE; + buttonIDs[NativeDefinitions.KEY_CAPSLOCK] = Component.Identifier.Key.CAPITAL; + buttonIDs[NativeDefinitions.KEY_F1] = Component.Identifier.Key.F1; + buttonIDs[NativeDefinitions.KEY_F2] = Component.Identifier.Key.F2; + buttonIDs[NativeDefinitions.KEY_F3] = Component.Identifier.Key.F3; + buttonIDs[NativeDefinitions.KEY_F4] = Component.Identifier.Key.F4; + buttonIDs[NativeDefinitions.KEY_F5] = Component.Identifier.Key.F5; + buttonIDs[NativeDefinitions.KEY_F6] = Component.Identifier.Key.F6; + buttonIDs[NativeDefinitions.KEY_F7] = Component.Identifier.Key.F7; + buttonIDs[NativeDefinitions.KEY_F8] = Component.Identifier.Key.F8; + buttonIDs[NativeDefinitions.KEY_F9] = Component.Identifier.Key.F9; + buttonIDs[NativeDefinitions.KEY_F10] = Component.Identifier.Key.F10; + buttonIDs[NativeDefinitions.KEY_NUMLOCK] = Component.Identifier.Key.NUMLOCK; + buttonIDs[NativeDefinitions.KEY_SCROLLLOCK] = Component.Identifier.Key.SCROLL; + buttonIDs[NativeDefinitions.KEY_KP7] = Component.Identifier.Key.NUMPAD7; + buttonIDs[NativeDefinitions.KEY_KP8] = Component.Identifier.Key.NUMPAD8; + buttonIDs[NativeDefinitions.KEY_KP9] = Component.Identifier.Key.NUMPAD9; + buttonIDs[NativeDefinitions.KEY_KPMINUS] = Component.Identifier.Key.SUBTRACT; + buttonIDs[NativeDefinitions.KEY_KP4] = Component.Identifier.Key.NUMPAD4; + buttonIDs[NativeDefinitions.KEY_KP5] = Component.Identifier.Key.NUMPAD5; + buttonIDs[NativeDefinitions.KEY_KP6] = Component.Identifier.Key.NUMPAD6; + buttonIDs[NativeDefinitions.KEY_KPPLUS] = Component.Identifier.Key.ADD; + buttonIDs[NativeDefinitions.KEY_KP1] = Component.Identifier.Key.NUMPAD1; + buttonIDs[NativeDefinitions.KEY_KP2] = Component.Identifier.Key.NUMPAD2; + buttonIDs[NativeDefinitions.KEY_KP3] = Component.Identifier.Key.NUMPAD3; + buttonIDs[NativeDefinitions.KEY_KP0] = Component.Identifier.Key.NUMPAD0; + buttonIDs[NativeDefinitions.KEY_KPDOT] = Component.Identifier.Key.DECIMAL; buttonIDs[NativeDefinitions.KEY_103RD] = null; - buttonIDs[NativeDefinitions.KEY_F13] = StandardKeyboard.KeyID.F13; + buttonIDs[NativeDefinitions.KEY_F13] = Component.Identifier.Key.F13; buttonIDs[NativeDefinitions.KEY_102ND] = null; - buttonIDs[NativeDefinitions.KEY_F11] = StandardKeyboard.KeyID.F11; - buttonIDs[NativeDefinitions.KEY_F12] = StandardKeyboard.KeyID.F12; - buttonIDs[NativeDefinitions.KEY_F14] = StandardKeyboard.KeyID.F14; - buttonIDs[NativeDefinitions.KEY_F15] = StandardKeyboard.KeyID.F15; + buttonIDs[NativeDefinitions.KEY_F11] = Component.Identifier.Key.F11; + buttonIDs[NativeDefinitions.KEY_F12] = Component.Identifier.Key.F12; + buttonIDs[NativeDefinitions.KEY_F14] = Component.Identifier.Key.F14; + buttonIDs[NativeDefinitions.KEY_F15] = Component.Identifier.Key.F15; buttonIDs[NativeDefinitions.KEY_F16] = null; buttonIDs[NativeDefinitions.KEY_F17] = null; buttonIDs[NativeDefinitions.KEY_F18] = null; buttonIDs[NativeDefinitions.KEY_F19] = null; buttonIDs[NativeDefinitions.KEY_F20] = null; - buttonIDs[NativeDefinitions.KEY_KPENTER] = StandardKeyboard.KeyID.NUMPADENTER; - buttonIDs[NativeDefinitions.KEY_RIGHTCTRL] = StandardKeyboard.KeyID.RCONTROL; - buttonIDs[NativeDefinitions.KEY_KPSLASH] = StandardKeyboard.KeyID.DIVIDE; - buttonIDs[NativeDefinitions.KEY_SYSRQ] = StandardKeyboard.KeyID.SYSRQ; - buttonIDs[NativeDefinitions.KEY_RIGHTALT] = StandardKeyboard.KeyID.RALT; + buttonIDs[NativeDefinitions.KEY_KPENTER] = Component.Identifier.Key.NUMPADENTER; + buttonIDs[NativeDefinitions.KEY_RIGHTCTRL] = Component.Identifier.Key.RCONTROL; + buttonIDs[NativeDefinitions.KEY_KPSLASH] = Component.Identifier.Key.DIVIDE; + buttonIDs[NativeDefinitions.KEY_SYSRQ] = Component.Identifier.Key.SYSRQ; + buttonIDs[NativeDefinitions.KEY_RIGHTALT] = Component.Identifier.Key.RALT; buttonIDs[NativeDefinitions.KEY_LINEFEED] = null; - buttonIDs[NativeDefinitions.KEY_HOME] = StandardKeyboard.KeyID.HOME; - buttonIDs[NativeDefinitions.KEY_UP] = StandardKeyboard.KeyID.UP; - buttonIDs[NativeDefinitions.KEY_PAGEUP] = LinuxKeyboard.KeyID.PAGEUP; - buttonIDs[NativeDefinitions.KEY_LEFT] = StandardKeyboard.KeyID.LEFT; - buttonIDs[NativeDefinitions.KEY_RIGHT] = StandardKeyboard.KeyID.RIGHT; - buttonIDs[NativeDefinitions.KEY_END] = StandardKeyboard.KeyID.END; - buttonIDs[NativeDefinitions.KEY_DOWN] = StandardKeyboard.KeyID.DOWN; - buttonIDs[NativeDefinitions.KEY_PAGEDOWN] = LinuxKeyboard.KeyID.PAGEDOWN; - buttonIDs[NativeDefinitions.KEY_INSERT] = StandardKeyboard.KeyID.INSERT; - buttonIDs[NativeDefinitions.KEY_DELETE] = StandardKeyboard.KeyID.DELETE; - buttonIDs[NativeDefinitions.KEY_PAUSE] = StandardKeyboard.KeyID.PAUSE; + buttonIDs[NativeDefinitions.KEY_HOME] = Component.Identifier.Key.HOME; + buttonIDs[NativeDefinitions.KEY_UP] = Component.Identifier.Key.UP; + buttonIDs[NativeDefinitions.KEY_PAGEUP] = Component.Identifier.Key.PAGEUP; + buttonIDs[NativeDefinitions.KEY_LEFT] = Component.Identifier.Key.LEFT; + buttonIDs[NativeDefinitions.KEY_RIGHT] = Component.Identifier.Key.RIGHT; + buttonIDs[NativeDefinitions.KEY_END] = Component.Identifier.Key.END; + buttonIDs[NativeDefinitions.KEY_DOWN] = Component.Identifier.Key.DOWN; + buttonIDs[NativeDefinitions.KEY_PAGEDOWN] = Component.Identifier.Key.PAGEDOWN; + buttonIDs[NativeDefinitions.KEY_INSERT] = Component.Identifier.Key.INSERT; + buttonIDs[NativeDefinitions.KEY_DELETE] = Component.Identifier.Key.DELETE; + buttonIDs[NativeDefinitions.KEY_PAUSE] = Component.Identifier.Key.PAUSE; /* buttonIDs[NativeDefinitions.KEY_MACRO] = "Macro"; buttonIDs[NativeDefinitions.KEY_MUTE] = "Mute"; buttonIDs[NativeDefinitions.KEY_VOLUMEDOWN] = "Volume Down"; buttonIDs[NativeDefinitions.KEY_VOLUMEUP] = "Volume Up"; buttonIDs[NativeDefinitions.KEY_POWER] = "Power";*/ - buttonIDs[NativeDefinitions.KEY_KPEQUAL] = StandardKeyboard.KeyID.NUMPADEQUAL; + buttonIDs[NativeDefinitions.KEY_KPEQUAL] = Component.Identifier.Key.NUMPADEQUAL; //buttonIDs[NativeDefinitions.KEY_KPPLUSMINUS] = "KeyPad +/-"; /* buttonIDs[NativeDefinitions.KEY_F21] = "F21"; buttonIDs[NativeDefinitions.KEY_F22] = "F22"; @@ -480,7 +480,7 @@ public class LinuxNativeTypesMap { buttonIDs[NativeDefinitions.KEY_MENU] = "Menu"; buttonIDs[NativeDefinitions.KEY_CALC] = "Calculator"; buttonIDs[NativeDefinitions.KEY_SETUP] = "Setup";*/ - buttonIDs[NativeDefinitions.KEY_SLEEP] = StandardKeyboard.KeyID.SLEEP; + buttonIDs[NativeDefinitions.KEY_SLEEP] = Component.Identifier.Key.SLEEP; /*buttonIDs[NativeDefinitions.KEY_WAKEUP] = "Wakeup"; buttonIDs[NativeDefinitions.KEY_FILE] = "File"; buttonIDs[NativeDefinitions.KEY_SENDFILE] = "Send File"; @@ -543,74 +543,74 @@ public class LinuxNativeTypesMap { buttonIDs[NativeDefinitions.KEY_PROG4] = "Program 4"; buttonIDs[NativeDefinitions.KEY_SUSPEND] = "Suspend"; buttonIDs[NativeDefinitions.KEY_CLOSE] = "Close";*/ - buttonIDs[NativeDefinitions.KEY_UNKNOWN] = StandardKeyboard.KeyID.UNLABELED; + buttonIDs[NativeDefinitions.KEY_UNKNOWN] = Component.Identifier.Key.UNLABELED; /*buttonIDs[NativeDefinitions.KEY_BRIGHTNESSDOWN] = "Brightness Down"; buttonIDs[NativeDefinitions.KEY_BRIGHTNESSUP] = "Brightness Up";*/ //Msic keys - buttonIDs[NativeDefinitions.BTN_0] = LinuxDevice.ButtonID.BTN_0; - buttonIDs[NativeDefinitions.BTN_1] = LinuxDevice.ButtonID.BTN_1; - buttonIDs[NativeDefinitions.BTN_2] = LinuxDevice.ButtonID.BTN_2; - buttonIDs[NativeDefinitions.BTN_3] = LinuxDevice.ButtonID.BTN_3; - buttonIDs[NativeDefinitions.BTN_4] = LinuxDevice.ButtonID.BTN_4; - buttonIDs[NativeDefinitions.BTN_5] = LinuxDevice.ButtonID.BTN_5; - buttonIDs[NativeDefinitions.BTN_6] = LinuxDevice.ButtonID.BTN_6; - buttonIDs[NativeDefinitions.BTN_7] = LinuxDevice.ButtonID.BTN_7; - buttonIDs[NativeDefinitions.BTN_8] = LinuxDevice.ButtonID.BTN_8; - buttonIDs[NativeDefinitions.BTN_9] = LinuxDevice.ButtonID.BTN_9; + buttonIDs[NativeDefinitions.BTN_0] = Component.Identifier.Button._0; + buttonIDs[NativeDefinitions.BTN_1] = Component.Identifier.Button._1; + buttonIDs[NativeDefinitions.BTN_2] = Component.Identifier.Button._2; + buttonIDs[NativeDefinitions.BTN_3] = Component.Identifier.Button._3; + buttonIDs[NativeDefinitions.BTN_4] = Component.Identifier.Button._4; + buttonIDs[NativeDefinitions.BTN_5] = Component.Identifier.Button._5; + buttonIDs[NativeDefinitions.BTN_6] = Component.Identifier.Button._6; + buttonIDs[NativeDefinitions.BTN_7] = Component.Identifier.Button._7; + buttonIDs[NativeDefinitions.BTN_8] = Component.Identifier.Button._8; + buttonIDs[NativeDefinitions.BTN_9] = Component.Identifier.Button._9; // Mouse - buttonIDs[NativeDefinitions.BTN_LEFT] = Mouse.ButtonID.LEFT; - buttonIDs[NativeDefinitions.BTN_RIGHT] = Mouse.ButtonID.RIGHT; - buttonIDs[NativeDefinitions.BTN_MIDDLE] = Mouse.ButtonID.MIDDLE; - buttonIDs[NativeDefinitions.BTN_SIDE] = Mouse.ButtonID.SIDE; - buttonIDs[NativeDefinitions.BTN_EXTRA] = Mouse.ButtonID.EXTRA; - buttonIDs[NativeDefinitions.BTN_FORWARD] = Mouse.ButtonID.FORWARD; - buttonIDs[NativeDefinitions.BTN_BACK] = Mouse.ButtonID.BACK; + buttonIDs[NativeDefinitions.BTN_LEFT] = Component.Identifier.Button.LEFT; + buttonIDs[NativeDefinitions.BTN_RIGHT] = Component.Identifier.Button.RIGHT; + buttonIDs[NativeDefinitions.BTN_MIDDLE] = Component.Identifier.Button.MIDDLE; + buttonIDs[NativeDefinitions.BTN_SIDE] = Component.Identifier.Button.SIDE; + buttonIDs[NativeDefinitions.BTN_EXTRA] = Component.Identifier.Button.EXTRA; + buttonIDs[NativeDefinitions.BTN_FORWARD] = Component.Identifier.Button.FORWARD; + buttonIDs[NativeDefinitions.BTN_BACK] = Component.Identifier.Button.BACK; // Joystick - buttonIDs[NativeDefinitions.BTN_TRIGGER] = LinuxDevice.ButtonID.BTN_TRIGGER; - buttonIDs[NativeDefinitions.BTN_THUMB] = LinuxDevice.ButtonID.BTN_THUMB; - buttonIDs[NativeDefinitions.BTN_THUMB2] = LinuxDevice.ButtonID.BTN_THUMB2; - buttonIDs[NativeDefinitions.BTN_TOP] = LinuxDevice.ButtonID.BTN_TOP; - buttonIDs[NativeDefinitions.BTN_TOP2] = LinuxDevice.ButtonID.BTN_TOP2; - buttonIDs[NativeDefinitions.BTN_PINKIE] = LinuxDevice.ButtonID.BTN_PINKIE; - buttonIDs[NativeDefinitions.BTN_BASE] = LinuxDevice.ButtonID.BTN_BASE; - buttonIDs[NativeDefinitions.BTN_BASE2] = LinuxDevice.ButtonID.BTN_BASE2; - buttonIDs[NativeDefinitions.BTN_BASE3] = LinuxDevice.ButtonID.BTN_BASE3; - buttonIDs[NativeDefinitions.BTN_BASE4] = LinuxDevice.ButtonID.BTN_BASE4; - buttonIDs[NativeDefinitions.BTN_BASE5] = LinuxDevice.ButtonID.BTN_BASE5; - buttonIDs[NativeDefinitions.BTN_BASE6] = LinuxDevice.ButtonID.BTN_BASE6; - buttonIDs[NativeDefinitions.BTN_DEAD] = LinuxDevice.ButtonID.BTN_DEAD; + buttonIDs[NativeDefinitions.BTN_TRIGGER] = Component.Identifier.Button.TRIGGER; + buttonIDs[NativeDefinitions.BTN_THUMB] = Component.Identifier.Button.THUMB; + buttonIDs[NativeDefinitions.BTN_THUMB2] = Component.Identifier.Button.THUMB2; + buttonIDs[NativeDefinitions.BTN_TOP] = Component.Identifier.Button.TOP; + buttonIDs[NativeDefinitions.BTN_TOP2] = Component.Identifier.Button.TOP2; + buttonIDs[NativeDefinitions.BTN_PINKIE] = Component.Identifier.Button.PINKIE; + buttonIDs[NativeDefinitions.BTN_BASE] = Component.Identifier.Button.BASE; + buttonIDs[NativeDefinitions.BTN_BASE2] = Component.Identifier.Button.BASE2; + buttonIDs[NativeDefinitions.BTN_BASE3] = Component.Identifier.Button.BASE3; + buttonIDs[NativeDefinitions.BTN_BASE4] = Component.Identifier.Button.BASE4; + buttonIDs[NativeDefinitions.BTN_BASE5] = Component.Identifier.Button.BASE5; + buttonIDs[NativeDefinitions.BTN_BASE6] = Component.Identifier.Button.BASE6; + buttonIDs[NativeDefinitions.BTN_DEAD] = Component.Identifier.Button.DEAD; // Gamepad - buttonIDs[NativeDefinitions.BTN_A] = LinuxDevice.ButtonID.BTN_A; - buttonIDs[NativeDefinitions.BTN_B] = LinuxDevice.ButtonID.BTN_B; - buttonIDs[NativeDefinitions.BTN_C] = LinuxDevice.ButtonID.BTN_C; - buttonIDs[NativeDefinitions.BTN_X] = LinuxDevice.ButtonID.BTN_X; - buttonIDs[NativeDefinitions.BTN_Y] = LinuxDevice.ButtonID.BTN_Y; - buttonIDs[NativeDefinitions.BTN_Z] = LinuxDevice.ButtonID.BTN_Z; - buttonIDs[NativeDefinitions.BTN_TL] = LinuxDevice.ButtonID.BTN_TL; - buttonIDs[NativeDefinitions.BTN_TR] = LinuxDevice.ButtonID.BTN_TR; - buttonIDs[NativeDefinitions.BTN_TL2] = LinuxDevice.ButtonID.BTN_TL2; - buttonIDs[NativeDefinitions.BTN_TR2] = LinuxDevice.ButtonID.BTN_TR2; - buttonIDs[NativeDefinitions.BTN_SELECT] = LinuxDevice.ButtonID.BTN_SELECT; - buttonIDs[NativeDefinitions.BTN_MODE] = LinuxDevice.ButtonID.BTN_MODE; - buttonIDs[NativeDefinitions.BTN_THUMBL] = LinuxDevice.ButtonID.BTN_THUMBL; - buttonIDs[NativeDefinitions.BTN_THUMBR] = LinuxDevice.ButtonID.BTN_THUMBR; + buttonIDs[NativeDefinitions.BTN_A] = Component.Identifier.Button.A; + buttonIDs[NativeDefinitions.BTN_B] = Component.Identifier.Button.B; + buttonIDs[NativeDefinitions.BTN_C] = Component.Identifier.Button.C; + buttonIDs[NativeDefinitions.BTN_X] = Component.Identifier.Button.X; + buttonIDs[NativeDefinitions.BTN_Y] = Component.Identifier.Button.Y; + buttonIDs[NativeDefinitions.BTN_Z] = Component.Identifier.Button.Z; + buttonIDs[NativeDefinitions.BTN_TL] = Component.Identifier.Button.LEFT_THUMB; + buttonIDs[NativeDefinitions.BTN_TR] = Component.Identifier.Button.RIGHT_THUMB; + buttonIDs[NativeDefinitions.BTN_TL2] = Component.Identifier.Button.LEFT_THUMB2; + buttonIDs[NativeDefinitions.BTN_TR2] = Component.Identifier.Button.RIGHT_THUMB2; + buttonIDs[NativeDefinitions.BTN_SELECT] = Component.Identifier.Button.SELECT; + buttonIDs[NativeDefinitions.BTN_MODE] = Component.Identifier.Button.MODE; + buttonIDs[NativeDefinitions.BTN_THUMBL] = Component.Identifier.Button.LEFT_THUMB3; + buttonIDs[NativeDefinitions.BTN_THUMBR] = Component.Identifier.Button.RIGHT_THUMB3; // Digitiser - buttonIDs[NativeDefinitions.BTN_TOOL_PEN] = LinuxDevice.ButtonID.BTN_TOOL_PEN; - buttonIDs[NativeDefinitions.BTN_TOOL_RUBBER] = LinuxDevice.ButtonID.BTN_TOOL_RUBBER; - buttonIDs[NativeDefinitions.BTN_TOOL_BRUSH] = LinuxDevice.ButtonID.BTN_TOOL_BRUSH; - buttonIDs[NativeDefinitions.BTN_TOOL_PENCIL] = LinuxDevice.ButtonID.BTN_TOOL_PENCIL; - buttonIDs[NativeDefinitions.BTN_TOOL_AIRBRUSH] = LinuxDevice.ButtonID.BTN_TOOL_AIRBRUSH; - buttonIDs[NativeDefinitions.BTN_TOOL_FINGER] = LinuxDevice.ButtonID.BTN_TOOL_FINGER; - buttonIDs[NativeDefinitions.BTN_TOOL_MOUSE] = LinuxDevice.ButtonID.BTN_TOOL_MOUSE; - buttonIDs[NativeDefinitions.BTN_TOOL_LENS] = LinuxDevice.ButtonID.BTN_TOOL_LENS; - buttonIDs[NativeDefinitions.BTN_TOUCH] = LinuxDevice.ButtonID.BTN_TOUCH; - buttonIDs[NativeDefinitions.BTN_STYLUS] = LinuxDevice.ButtonID.BTN_STYLUS; - buttonIDs[NativeDefinitions.BTN_STYLUS2] = LinuxDevice.ButtonID.BTN_STYLUS2; + buttonIDs[NativeDefinitions.BTN_TOOL_PEN] = Component.Identifier.Button.TOOL_PEN; + buttonIDs[NativeDefinitions.BTN_TOOL_RUBBER] = Component.Identifier.Button.TOOL_RUBBER; + buttonIDs[NativeDefinitions.BTN_TOOL_BRUSH] = Component.Identifier.Button.TOOL_BRUSH; + buttonIDs[NativeDefinitions.BTN_TOOL_PENCIL] = Component.Identifier.Button.TOOL_PENCIL; + buttonIDs[NativeDefinitions.BTN_TOOL_AIRBRUSH] = Component.Identifier.Button.TOOL_AIRBRUSH; + buttonIDs[NativeDefinitions.BTN_TOOL_FINGER] = Component.Identifier.Button.TOOL_FINGER; + buttonIDs[NativeDefinitions.BTN_TOOL_MOUSE] = Component.Identifier.Button.TOOL_MOUSE; + buttonIDs[NativeDefinitions.BTN_TOOL_LENS] = Component.Identifier.Button.TOOL_LENS; + buttonIDs[NativeDefinitions.BTN_TOUCH] = Component.Identifier.Button.TOUCH; + buttonIDs[NativeDefinitions.BTN_STYLUS] = Component.Identifier.Button.STYLUS; + buttonIDs[NativeDefinitions.BTN_STYLUS2] = Component.Identifier.Button.STYLUS2; relAxesNames = new String[NativeDefinitions.REL_MAX]; relAxesNames[NativeDefinitions.REL_X] = "X axis"; @@ -621,15 +621,15 @@ public class LinuxNativeTypesMap { relAxesNames[NativeDefinitions.REL_WHEEL] = "Vertical wheel"; relAxesNames[NativeDefinitions.REL_MISC] = "Miscellaneous"; - relAxesIDs = new Axis.Identifier[NativeDefinitions.REL_MAX]; - relAxesIDs[NativeDefinitions.REL_X] = Axis.Identifier.X; - relAxesIDs[NativeDefinitions.REL_Y] = Axis.Identifier.Y; - relAxesIDs[NativeDefinitions.REL_Z] = Axis.Identifier.Z; - relAxesIDs[NativeDefinitions.REL_WHEEL] = Axis.Identifier.SLIDER; + relAxesIDs = new Component.Identifier[NativeDefinitions.REL_MAX]; + relAxesIDs[NativeDefinitions.REL_X] = Component.Identifier.Axis.X; + relAxesIDs[NativeDefinitions.REL_Y] = Component.Identifier.Axis.Y; + relAxesIDs[NativeDefinitions.REL_Z] = Component.Identifier.Axis.Z; + relAxesIDs[NativeDefinitions.REL_WHEEL] = Component.Identifier.Axis.SLIDER; // There are guesses as I have no idea what they would be used for - relAxesIDs[NativeDefinitions.REL_HWHEEL] = Axis.Identifier.SLIDER; - relAxesIDs[NativeDefinitions.REL_DIAL] = Axis.Identifier.SLIDER; - relAxesIDs[NativeDefinitions.REL_MISC] = Axis.Identifier.SLIDER; + relAxesIDs[NativeDefinitions.REL_HWHEEL] = Component.Identifier.Axis.SLIDER; + relAxesIDs[NativeDefinitions.REL_DIAL] = Component.Identifier.Axis.SLIDER; + relAxesIDs[NativeDefinitions.REL_MISC] = Component.Identifier.Axis.SLIDER; absAxesNames = new String[NativeDefinitions.ABS_MAX]; absAxesNames[NativeDefinitions.ABS_X] = "X axis"; @@ -658,27 +658,27 @@ public class LinuxNativeTypesMap { absAxesNames[NativeDefinitions.ABS_TILT_Y] = "Y axis tilt"; absAxesNames[NativeDefinitions.ABS_MISC] = "Miscellaneous"; - absAxesIDs = new Axis.Identifier[NativeDefinitions.ABS_MAX]; - absAxesIDs[NativeDefinitions.ABS_X] = Axis.Identifier.X; - absAxesIDs[NativeDefinitions.ABS_Y] = Axis.Identifier.Y; - absAxesIDs[NativeDefinitions.ABS_Z] = Axis.Identifier.Z; - absAxesIDs[NativeDefinitions.ABS_RX] = Axis.Identifier.RX; - absAxesIDs[NativeDefinitions.ABS_RY] = Axis.Identifier.RY; - absAxesIDs[NativeDefinitions.ABS_RZ] = Axis.Identifier.RZ; - absAxesIDs[NativeDefinitions.ABS_THROTTLE] = Axis.Identifier.SLIDER; - absAxesIDs[NativeDefinitions.ABS_RUDDER] = Axis.Identifier.RZ; - absAxesIDs[NativeDefinitions.ABS_WHEEL] = Axis.Identifier.Y; - absAxesIDs[NativeDefinitions.ABS_GAS] = Axis.Identifier.SLIDER; - absAxesIDs[NativeDefinitions.ABS_BRAKE] = Axis.Identifier.SLIDER; + absAxesIDs = new Component.Identifier[NativeDefinitions.ABS_MAX]; + absAxesIDs[NativeDefinitions.ABS_X] = Component.Identifier.Axis.X; + absAxesIDs[NativeDefinitions.ABS_Y] = Component.Identifier.Axis.Y; + absAxesIDs[NativeDefinitions.ABS_Z] = Component.Identifier.Axis.Z; + absAxesIDs[NativeDefinitions.ABS_RX] = Component.Identifier.Axis.RX; + absAxesIDs[NativeDefinitions.ABS_RY] = Component.Identifier.Axis.RY; + absAxesIDs[NativeDefinitions.ABS_RZ] = Component.Identifier.Axis.RZ; + absAxesIDs[NativeDefinitions.ABS_THROTTLE] = Component.Identifier.Axis.SLIDER; + absAxesIDs[NativeDefinitions.ABS_RUDDER] = Component.Identifier.Axis.RZ; + absAxesIDs[NativeDefinitions.ABS_WHEEL] = Component.Identifier.Axis.Y; + absAxesIDs[NativeDefinitions.ABS_GAS] = Component.Identifier.Axis.SLIDER; + absAxesIDs[NativeDefinitions.ABS_BRAKE] = Component.Identifier.Axis.SLIDER; // Hats are done this way as they are mapped from two axis down to one - absAxesIDs[NativeDefinitions.ABS_HAT0X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT0Y] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT1X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT1Y] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT2X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT2Y] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT3X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT3Y] = Axis.Identifier.POV; + absAxesIDs[NativeDefinitions.ABS_HAT0X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT0Y] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT1X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT1Y] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT2X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT2Y] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT3X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT3Y] = Component.Identifier.Axis.POV; // erm, yeah absAxesIDs[NativeDefinitions.ABS_PRESSURE] = null; absAxesIDs[NativeDefinitions.ABS_DISTANCE] = null; @@ -753,10 +753,10 @@ public class LinuxNativeTypesMap { * @param nativeID The axis type ID * @return The jinput id */ - public static Axis.Identifier getRelAxisID(int nativeID) { - Axis.Identifier retval = INSTANCE.relAxesIDs[nativeID]; + public static Component.Identifier getRelAxisID(int nativeID) { + Component.Identifier retval = INSTANCE.relAxesIDs[nativeID]; if(retval == null) { - retval = Axis.Identifier.SLIDER_VELOCITY; + retval = Component.Identifier.Axis.SLIDER_VELOCITY; INSTANCE.relAxesIDs[nativeID] = retval; } return retval; @@ -766,10 +766,10 @@ public class LinuxNativeTypesMap { * @param nativeID The native axis type id * @return The jinput id */ - public static Axis.Identifier getAbsAxisID(int nativeID) { - Axis.Identifier retval = INSTANCE.absAxesIDs[nativeID]; + public static Component.Identifier getAbsAxisID(int nativeID) { + Component.Identifier retval = INSTANCE.absAxesIDs[nativeID]; if(retval == null) { - retval = Axis.Identifier.SLIDER; + retval = Component.Identifier.Axis.SLIDER; INSTANCE.absAxesIDs[nativeID] = retval; } return retval; @@ -779,10 +779,10 @@ public class LinuxNativeTypesMap { * @param nativeID The native button type id * @return The jinput id */ - public static Axis.Identifier getButtonID(int nativeID) { - Axis.Identifier retval = INSTANCE.buttonIDs[nativeID]; + public static Component.Identifier getButtonID(int nativeID) { + Component.Identifier retval = INSTANCE.buttonIDs[nativeID]; if(retval == null) { - retval = new LinuxKeyboard.KeyID(nativeID, getButtonName(nativeID)); + retval = Component.Identifier.Key.UNKNOWN; INSTANCE.buttonIDs[nativeID] = retval; } return retval; |