diff options
author | gregorypierce <[email protected]> | 2004-02-28 01:26:36 +0000 |
---|---|---|
committer | gregorypierce <[email protected]> | 2004-02-28 01:26:36 +0000 |
commit | 5ffcc9b176306a52afb2dd4c1aa68d8da22ff2f3 (patch) | |
tree | c511805601f2eb660887c3fffb5a8fc887316558 /plugins/OSX | |
parent | c3307002266097cd5345cf848ba2580363ca4f02 (diff) |
Updated so that if a key gets enumerated multiple times, only the first enumeration will be accepted. This was done to stop an issue with certain keys in OSX being enumerated more than once - the first being the correct HID code (assumption) and the second being something wrong. It is not clear why those keys were being enumerated more than once to begin with. But this solves the problem.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@71 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins/OSX')
-rw-r--r-- | plugins/OSX/src/java/net/java/games/input/OSXKeyboard.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/plugins/OSX/src/java/net/java/games/input/OSXKeyboard.java b/plugins/OSX/src/java/net/java/games/input/OSXKeyboard.java index 0fdcef3..4809a75 100644 --- a/plugins/OSX/src/java/net/java/games/input/OSXKeyboard.java +++ b/plugins/OSX/src/java/net/java/games/input/OSXKeyboard.java @@ -168,27 +168,38 @@ public class OSXKeyboard extends StandardKeyboard implements InputController public void addControllerElement(InputControllerElement element) { - //System.out.println("Adding keyboard elements usage page[" + element.getUsagePage() + "] usage [" + element.getUsage() + "] type [" + element.getElementType() + "]" ); + System.out.println("Adding keyboard elements usage page[" + element.getUsagePage() + "] usage [" + element.getUsage() + "] type [" + element.getElementType() + "]" ); switch( element.getUsagePage() ) { case OSXEnvironmentPlugin.HID_USAGEPAGE_KEYBOARD: - //System.out.println("Found keyboard element"); + System.out.println("Found keyboard element"); if ( element.getElementType() == OSXEnvironmentPlugin.HID_ELEMENTTYPE_INPUT_BUTTON ) { - System.out.println("Adding key [" + element.getUsage() + "]"); - // register this key with the queue system as all buttons are retrieved from the // input controllers queue // - plugin.registerDeviceElement( lpQueue, element.getHidCookie() ); - - //TODO: Optimize this - put the usages in another array the same size as the crosstable so the hidCookies - // can be retrieved directly without the Long creation - keys.put( new Long( element.getUsage()), element ); + System.out.println("Registering button-key (usage page [" + element.getUsagePage() + "], usage[" + element.getUsage() + "], elementType [" + element.getElementType() + "], hidCookie [" + element.getHidCookie() + "])"); + + + if ( keys.get( new Long( element.getUsage() )) == null ) + { + plugin.registerDeviceElement( lpQueue, element.getHidCookie() ); + + keys.put( new Long( element.getUsage() ), element ); + System.out.println("Registered key [" + element.getHidCookie() + "]"); + } + else + { + System.out.println("Ignoring key [" + element.getHidCookie() + "] already enumerated."); + } } + else + { + System.out.println("Ignoring non-button-key (usage page [" + element.getUsagePage() + "], usage[" + element.getUsage() + "], elementType [" + element.getElementType() + "], hidCookie [" + element.getHidCookie() + "])"); + } break; default: |