Пример #1
0
 private static final Keyboard createKeyboardFromDevice(OSXHIDDevice device, List elements)
     throws IOException {
   List components = new ArrayList();
   OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
   try {
     addElements(queue, elements, components, false);
   } catch (IOException e) {
     queue.release();
     throw e;
   }
   Component[] components_array = new Component[components.size()];
   components.toArray(components_array);
   Keyboard keyboard =
       new OSXKeyboard(device, queue, components_array, new Controller[] {}, new Rumbler[] {});
   return keyboard;
 }
Пример #2
0
 private static final AbstractController createControllerFromDevice(
     OSXHIDDevice device, List elements, Controller.Type type) throws IOException {
   List components = new ArrayList();
   OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
   try {
     addElements(queue, elements, components, false);
   } catch (IOException e) {
     queue.release();
     throw e;
   }
   Component[] components_array = new Component[components.size()];
   components.toArray(components_array);
   AbstractController controller =
       new OSXAbstractController(
           device, queue, components_array, new Controller[] {}, new Rumbler[] {}, type);
   return controller;
 }
Пример #3
0
 private static final Mouse createMouseFromDevice(OSXHIDDevice device, List elements)
     throws IOException {
   List components = new ArrayList();
   OSXHIDQueue queue = device.createQueue(AbstractController.EVENT_QUEUE_DEPTH);
   try {
     addElements(queue, elements, components, true);
   } catch (IOException e) {
     queue.release();
     throw e;
   }
   Component[] components_array = new Component[components.size()];
   components.toArray(components_array);
   Mouse mouse =
       new OSXMouse(device, queue, components_array, new Controller[] {}, new Rumbler[] {});
   if (mouse.getPrimaryButton() != null && mouse.getX() != null && mouse.getY() != null) {
     return mouse;
   } else {
     queue.release();
     return null;
   }
 }