/** * "Create" the mouse with the given custom implementation. This is used * reflectively by AWTInputAdapter. * * @throws LWJGLException if the mouse could not be created for any reason */ private static void create(InputImplementation impl) throws LWJGLException { if (created) return; if (!initialized) initialize(); implementation = impl; implementation.createMouse(); hasWheel = implementation.hasWheel(); created = true; // set mouse buttons buttonCount = implementation.getButtonCount(); buttons = BufferUtils.createByteBuffer(buttonCount); coord_buffer = BufferUtils.createIntBuffer(3); if (currentCursor != null && implementation.getNativeCursorCapabilities() != 0) setNativeCursor(currentCursor); readBuffer = ByteBuffer.allocate(EVENT_SIZE * BUFFER_SIZE); readBuffer.limit(0); setGrabbed(isGrabbed); }
static InputImplementation createImplementation() { /* Use reflection since we can't make Display.getImplementation * public */ try { return AccessController.doPrivileged(new PrivilegedExceptionAction<InputImplementation>() { public InputImplementation run() throws Exception { Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation"); getImplementation_method.setAccessible(true); return (InputImplementation)getImplementation_method.invoke(null); } }); } catch (PrivilegedActionException e) { throw new Error(e); } }
/** * "Create" the keyboard with the given implementation. This is used * reflectively from AWTInputAdapter. * * @throws LWJGLException if the keyboard could not be created for any reason */ private static void create(InputImplementation impl) throws LWJGLException { if (created) return; if (!initialized) initialize(); implementation = impl; implementation.createKeyboard(); created = true; readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE); reset(); }
static InputImplementation getImplementation() { return implementation; }