private final static void addElements(OSXHIDQueue queue, List elements, List components, boolean map_mouse_buttons) throws IOException { Iterator it = elements.iterator(); while (it.hasNext()) { OSXHIDElement element = (OSXHIDElement)it.next(); Component.Identifier id = element.getIdentifier(); if (id == null) continue; if (map_mouse_buttons) { if (id == Component.Identifier.Button._0) { id = Component.Identifier.Button.LEFT; } else if (id == Component.Identifier.Button._1) { id = Component.Identifier.Button.RIGHT; } else if (id == Component.Identifier.Button._2) { id = Component.Identifier.Button.MIDDLE; } } OSXComponent component = new OSXComponent(id, element); components.add(component); queue.addElement(element, component); } }
public final static synchronized boolean getNextDeviceEvent(Event event, OSXHIDQueue queue) throws IOException { if (queue.getNextEvent(osx_event)) { OSXComponent component = queue.mapEvent(osx_event); event.set(component, component.getElement().convertValue(osx_event.getValue()), osx_event.getNanos()); return true; } else return false; } }