|
From: <eli...@us...> - 2006-07-03 19:10:09
|
Revision: 2429 Author: elias_naur Date: 2006-07-03 12:09:47 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2429&view=rev Log Message: ----------- Now that no native side event_queue_t type is used anymore, convert input read() semantics to use normal nio Buffer semantics - that is, move the position when writing events Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -348,8 +348,7 @@ private static void read() { readBuffer.compact(); - int numEvents = Display.getImplementation().readKeyboard(readBuffer); - readBuffer.position(readBuffer.position() + numEvents*EVENT_SIZE); + Display.getImplementation().readKeyboard(readBuffer); readBuffer.flip(); } Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -306,8 +306,7 @@ private static void read() { readBuffer.compact(); - int numEvents = Display.getImplementation().readMouse(readBuffer); - readBuffer.position(readBuffer.position() + numEvents * EVENT_SIZE); + Display.getImplementation().readMouse(readBuffer); readBuffer.flip(); } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -150,10 +150,8 @@ /** * Method to read the keyboard buffer - * - * @return the total number of events read. */ - int readMouse(IntBuffer buffer); + void readMouse(IntBuffer buffer); void grabMouse(boolean grab); @@ -198,9 +196,8 @@ /** * Method to read the keyboard buffer - * @return the total number of events read. */ - int readKeyboard(IntBuffer buffer); + void readKeyboard(IntBuffer buffer); // int isStateKeySet(int key); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -62,8 +62,7 @@ * the behaviour of the native event queues. * @return the number of events copied */ - public synchronized int copyEvents(IntBuffer dest) { - int old_position = dest.position(); + public synchronized void copyEvents(IntBuffer dest) { queue.flip(); int old_limit = queue.limit(); if (dest.remaining() < queue.remaining()) @@ -71,9 +70,6 @@ dest.put(queue); queue.limit(old_limit); queue.compact(); - int num_events = (dest.position() - old_position)/event_size; - dest.position(old_position); - return num_events; } /** Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -648,11 +648,11 @@ } } - public int readMouse(IntBuffer buffer) { + public void readMouse(IntBuffer buffer) { update(); lockAWT(); try { - return mouse.read(buffer); + mouse.read(buffer); } finally { unlockAWT(); } @@ -818,11 +818,11 @@ } } - public int readKeyboard(IntBuffer buffer) { + public void readKeyboard(IntBuffer buffer) { update(); lockAWT(); try { - return keyboard.read(buffer); + keyboard.read(buffer); } finally { unlockAWT(); } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -152,8 +152,8 @@ private static native void destroyIC(long xic); private static native void closeIM(long xim); - public int read(IntBuffer buffer) { - return event_queue.copyEvents(buffer); + public void read(IntBuffer buffer) { + event_queue.copyEvents(buffer); } public void poll(ByteBuffer keyDownBuffer) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -86,8 +86,8 @@ accum_dx = accum_dy = 0; } - public int read(IntBuffer buffer) { - return event_queue.copyEvents(buffer); + public void read(IntBuffer buffer) { + event_queue.copyEvents(buffer); } public void poll(boolean grab, IntBuffer coord_buffer, ByteBuffer buttons_buffer) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -321,8 +321,8 @@ mouse_queue.poll(coord_buffer, buttons_buffer); } - public int readMouse(IntBuffer buffer) { - return mouse_queue.copyEvents(buffer); + public void readMouse(IntBuffer buffer) { + mouse_queue.copyEvents(buffer); } public void grabMouse(boolean grab) { @@ -407,8 +407,8 @@ keyboard_queue.poll(keyDownBuffer); } - public int readKeyboard(IntBuffer buffer) { - return keyboard_queue.copyEvents(buffer); + public void readKeyboard(IntBuffer buffer) { + keyboard_queue.copyEvents(buffer); } /* public int isStateKeySet(int key) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -206,9 +206,9 @@ mouse.poll(coord_buffer, buttons); } - public int readMouse(IntBuffer buffer) { + public void readMouse(IntBuffer buffer) { update(); - return mouse.read(buffer); + mouse.read(buffer); } public void grabMouse(boolean grab) { @@ -251,9 +251,9 @@ keyboard.poll(keyDownBuffer); } - public int readKeyboard(IntBuffer buffer) { + public void readKeyboard(IntBuffer buffer) { update(); - return keyboard.read(buffer); + keyboard.read(buffer); } // public native int isStateKeySet(int key); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -103,15 +103,13 @@ } } - private int translateData(IntBuffer src, IntBuffer dst) { + private void translateData(IntBuffer src, IntBuffer dst) { int dst_index = dst.position(); - int num_events = 0; - while (dst_index < dst.limit() && src.hasRemaining()) { - num_events++; + while (dst.hasRemaining() && src.hasRemaining()) { int dwOfs = src.get(); - dst.put(dst_index++, dwOfs); + dst.put(dwOfs); int dwData = src.get(); - dst.put(dst_index++, dwData); + dst.put(dwData); boolean key_down = (dwData & 0x80) != 0; if (key_down) { int virt_key = MapVirtualKey(dwOfs, 1); @@ -128,33 +126,31 @@ int current_char = 0; do { if (current_char >= 1) { - num_events++; - dst.put(dst_index++, 0); - dst.put(dst_index++, 0); + dst.put(0); + dst.put(0); } int char_int = ((int)unicode_buffer.get()) & 0xFFFF; - dst.put(dst_index++, char_int); + dst.put(char_int); current_char++; - } while (dst_index < dst.limit() && current_char < num_chars); + } while (dst.hasRemaining() && current_char < num_chars); } else { - dst.put(dst_index++, 0); + dst.put(0); } } else { - dst.put(dst_index++, 0); + dst.put(0); } } else - dst.put(dst_index++, 0); + dst.put(0); } - return num_events; } private static native int MapVirtualKey(int uCode, int uMapType); private static native int ToUnicode(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, CharBuffer pwszBuff, int cchBuff, int flags); private static native int GetKeyboardState(ByteBuffer lpKeyState); - public int read(IntBuffer buffer) { + public void read(IntBuffer buffer) { int ret = keyboard.acquire(); if (ret != WindowsDirectInput.DI_OK && ret != WindowsDirectInput.DI_NOEFFECT) - return 0; + return; keyboard.poll(); temp_data_buffer.clear(); ret = keyboard.getDeviceData(temp_data_buffer); @@ -173,6 +169,6 @@ break; } temp_data_buffer.flip(); - return translateData(temp_data_buffer, buffer); + translateData(temp_data_buffer, buffer); } } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java 2006-07-03 18:56:15 UTC (rev 2428) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java 2006-07-03 19:09:47 UTC (rev 2429) @@ -261,9 +261,9 @@ } } - public int read(IntBuffer buffer) { + public void read(IntBuffer buffer) { readDXBuffer(); - return event_queue.copyEvents(buffer); + event_queue.copyEvents(buffer); } public void grab(boolean grab) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-03 23:16:51
|
Revision: 2433 Author: elias_naur Date: 2006-07-03 16:16:26 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2433&view=rev Log Message: ----------- Implemented variable sized events in preparation of timestamped input events Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -55,6 +55,9 @@ * $Id$ */ public class Keyboard { + /** Internal use - event size in bytes */ + public static final int EVENT_SIZE = 4 + 1 + 4; + /** * The special character meaning that no * character was translated for the event. @@ -199,8 +202,6 @@ /** Buffer size in events */ private static final int BUFFER_SIZE = 50; - /** Event size in elements */ - private static final int EVENT_SIZE = 3; /** Key names */ private static final String[] keyName = new String[255]; @@ -245,7 +246,7 @@ * followed by state. The state is followed by * a 4 byte code point representing the translated character. */ - private static IntBuffer readBuffer; + private static ByteBuffer readBuffer; /** The current keyboard character being examined */ private static int eventCharacter; @@ -290,7 +291,7 @@ return; Display.getImplementation().createKeyboard(); created = true; - readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE*BUFFER_SIZE); + readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE); reset(); } @@ -422,9 +423,9 @@ throw new IllegalStateException("Keyboard must be created before you can read events"); if (readBuffer.hasRemaining()) { - eventKey = readBuffer.get() & 0xFF; + eventKey = readBuffer.getInt() & 0xFF; eventState = readBuffer.get() != 0; - eventCharacter = readBuffer.get(); + eventCharacter = readBuffer.getInt(); return true; } else { return false; Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -59,6 +59,9 @@ * $Id$ */ public class Mouse { + /** Internal use - event size in bytes */ + public static final int EVENT_SIZE = 1 + 1 + 4 + 4 + 4; + /** Has the mouse been created? */ private static boolean created; @@ -102,7 +105,7 @@ private static boolean initialized; /** The mouse button events from the last read */ - private static IntBuffer readBuffer; + private static ByteBuffer readBuffer; /** The current mouse event button being examined */ private static int eventButton; @@ -120,8 +123,6 @@ /** Buffer size in events */ private static final int BUFFER_SIZE = 50; - /** Event size in elements */ - private static final int EVENT_SIZE = 5; private static boolean isGrabbed; @@ -232,7 +233,7 @@ coord_buffer = BufferUtils.createIntBuffer(3); if (currentCursor != null) setNativeCursor(currentCursor); - readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE * BUFFER_SIZE); + readBuffer = ByteBuffer.allocate(EVENT_SIZE * BUFFER_SIZE); readBuffer.limit(0); setGrabbed(isGrabbed); } @@ -363,13 +364,13 @@ eventButton = readBuffer.get(); eventState = readBuffer.get() != 0; if (isGrabbed()) { - event_dx = readBuffer.get(); - event_dy = readBuffer.get(); + event_dx = readBuffer.getInt(); + event_dy = readBuffer.getInt(); event_x += event_dx; event_y += event_dy; } else { - int new_event_x = readBuffer.get(); - int new_event_y = readBuffer.get(); + int new_event_x = readBuffer.getInt(); + int new_event_y = readBuffer.getInt(); event_dx = new_event_x - event_x; event_dy = new_event_y - event_y; event_x = new_event_x; @@ -377,7 +378,7 @@ } event_x = Math.min(Display.getDisplayMode().getWidth() - 1, Math.max(0, event_x)); event_y = Math.min(Display.getDisplayMode().getHeight() - 1, Math.max(0, event_y)); - event_dwheel = readBuffer.get(); + event_dwheel = readBuffer.getInt(); return true; } else return false; Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -151,7 +151,7 @@ /** * Method to read the keyboard buffer */ - void readMouse(IntBuffer buffer); + void readMouse(ByteBuffer buffer); void grabMouse(boolean grab); @@ -197,7 +197,7 @@ /** * Method to read the keyboard buffer */ - void readKeyboard(IntBuffer buffer); + void readKeyboard(ByteBuffer buffer); // int isStateKeySet(int key); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -40,16 +40,15 @@ import java.nio.IntBuffer; class EventQueue { - private static final int QUEUE_SIZE = 200; private final int event_size; - private final IntBuffer queue; + private final ByteBuffer queue; protected EventQueue(int event_size) { this.event_size = event_size; - this.queue = ByteBuffer.allocateDirect(QUEUE_SIZE*event_size).asIntBuffer(); + this.queue = ByteBuffer.allocate(QUEUE_SIZE*event_size); } protected synchronized void clearEvents() { @@ -59,7 +58,7 @@ /** * Copy available events into the specified buffer. */ - public synchronized void copyEvents(IntBuffer dest) { + public synchronized void copyEvents(ByteBuffer dest) { queue.flip(); int old_limit = queue.limit(); if (dest.remaining() < queue.remaining()) @@ -73,10 +72,10 @@ * Put an event into the queue. * @return true if the event fitted into the queue, false otherwise */ - public synchronized boolean putEvent(int[] event) { - if (event.length != event_size) - throw new IllegalArgumentException("Internal error: event size " + event_size + " does not equals the given event size " + event.length); - if (queue.remaining() >= event.length) { + public synchronized boolean putEvent(ByteBuffer event) { + if (event.remaining() != event_size) + throw new IllegalArgumentException("Internal error: event size " + event_size + " does not equal the given event size " + event.remaining()); + if (queue.remaining() >= event.remaining()) { queue.put(event); return true; } else Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -44,14 +44,12 @@ import org.lwjgl.input.Keyboard; final class KeyboardEventQueue extends EventQueue implements KeyListener { - private static final int[] KEY_MAP = new int[0xffff]; - private static final int EVENT_SIZE = 3; private final byte[] key_states = new byte[Keyboard.KEYBOARD_SIZE]; /** Event scratch array */ - private final int[] event = new int[EVENT_SIZE]; + private final ByteBuffer event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); static { KEY_MAP[KeyEvent.VK_0] = Keyboard.KEY_0; @@ -241,14 +239,14 @@ } public KeyboardEventQueue() { - super(EVENT_SIZE); + super(Keyboard.EVENT_SIZE); } - private void putKeyboardEvent(int key_code, int state, int character) { - event[0] = key_code; - event[1] = state; - event[2] = character; + private void putKeyboardEvent(int key_code, byte state, int character) { + event.putInt(key_code).put(state).putInt(character); + event.flip(); putEvent(event); + event.compact(); } public synchronized void poll(ByteBuffer key_down_buffer) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -648,7 +648,7 @@ } } - public void readMouse(IntBuffer buffer) { + public void readMouse(ByteBuffer buffer) { update(); lockAWT(); try { @@ -818,7 +818,7 @@ } } - public void readKeyboard(IntBuffer buffer) { + public void readKeyboard(ByteBuffer buffer) { update(); lockAWT(); try { @@ -972,7 +972,7 @@ /* Callbacks from nUpdate() */ private static void handleButtonEvent(long millis, int type, int button, int state) { if (mouse != null) - mouse.handleButtonEvent(grab, type, button); + mouse.handleButtonEvent(grab, type, (byte)button); } private static void handleKeyEvent(long event_ptr, long millis, int type, int keycode, int state) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -55,8 +55,6 @@ private static final int XLookupChars = 2; private static final int XLookupBoth = 4; - - private static final int EVENT_SIZE = 3; private static final int KEYBOARD_BUFFER_SIZE = 50; private final long xim; @@ -70,9 +68,9 @@ private final ByteBuffer compose_status; private final byte[] key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE]; - private final EventQueue event_queue = new EventQueue(EVENT_SIZE); + private final EventQueue event_queue = new EventQueue(Keyboard.EVENT_SIZE); - private final int[] tmp_event = new int[3]; + private final ByteBuffer tmp_event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); private final int[] temp_translation_buffer = new int[KEYBOARD_BUFFER_SIZE]; private final ByteBuffer native_translation_buffer = BufferUtils.createByteBuffer(KEYBOARD_BUFFER_SIZE); private final CharsetDecoder utf8_decoder = Charset.forName("UTF-8").newDecoder(); @@ -152,7 +150,7 @@ private static native void destroyIC(long xic); private static native void closeIM(long xim); - public void read(IntBuffer buffer) { + public void read(ByteBuffer buffer) { event_queue.copyEvents(buffer); } @@ -162,11 +160,11 @@ keyDownBuffer.position(old_position); } - private void putKeyboardEvent(int keycode, int state, int ch) { - tmp_event[0] = keycode; - tmp_event[1] = state; - tmp_event[2] = ch; + private void putKeyboardEvent(int keycode, byte state, int ch) { + tmp_event.putInt(keycode).put(state).putInt(ch); + tmp_event.flip(); event_queue.putEvent(tmp_event); + tmp_event.compact(); } private int lookupStringISO88591(long event_ptr, int[] translation_buffer) { @@ -204,7 +202,7 @@ return lookupStringISO88591(event_ptr, translation_buffer); } - private void translateEvent(long event_ptr, int event_type, int keycode, int key_state) { + private void translateEvent(long event_ptr, int event_type, int keycode, byte key_state) { int num_chars, i; int ch; @@ -218,7 +216,7 @@ putKeyboardEvent(keycode, key_state, ch); for (i = 1; i < num_chars; i++) { ch = temp_translation_buffer[i]; - putKeyboardEvent(0, 0, ch); + putKeyboardEvent(0, (byte)0, ch); } } else { putKeyboardEvent(keycode, key_state, 0); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -46,7 +46,6 @@ import java.nio.charset.Charset; final class LinuxMouse { - private static final int EVENT_SIZE = 5; private static final int NUM_BUTTONS = 3; private static final int POINTER_WARP_BORDER = 10; // scale the mouse wheel according to DirectInput @@ -65,7 +64,7 @@ private final long display; private final long window; private final IntBuffer query_pointer_buffer = BufferUtils.createIntBuffer(4); - private final int[] event_buffer = new int[EVENT_SIZE]; + private final ByteBuffer event_buffer = ByteBuffer.allocate(Mouse.EVENT_SIZE); private int last_x; private int last_y; @@ -82,11 +81,11 @@ } private void reset() { - event_queue = new EventQueue(EVENT_SIZE); + event_queue = new EventQueue(event_buffer.capacity()); accum_dx = accum_dy = 0; } - public void read(IntBuffer buffer) { + public void read(ByteBuffer buffer) { event_queue.copyEvents(buffer); } @@ -104,13 +103,11 @@ buttons_buffer.put(i, buttons[i]); } - private boolean putMouseEventWithCoords(int button, int state, int coord1, int coord2, int dz) { - event_buffer[0] = button; - event_buffer[1] = state; - event_buffer[2] = coord1; - event_buffer[3] = coord2; - event_buffer[4] = dz; - return event_queue.putEvent(event_buffer); + private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz) { + event_buffer.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz); + event_buffer.flip(); + event_queue.putEvent(event_buffer); + event_buffer.compact(); } private void setCursorPos(boolean grab, int x, int y) { @@ -122,9 +119,9 @@ last_x = x; last_y = y; if (grab) { - putMouseEventWithCoords(-1, 0, dx, dy, 0); + putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0); } else { - putMouseEventWithCoords(-1, 0, x, y, 0); + putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0); } } @@ -192,16 +189,16 @@ } private void handleButton(boolean grab, int button, byte state) { - int button_num; + byte button_num; switch (button) { case Button1: - button_num = 0; + button_num = (byte)0; break; case Button2: - button_num = 2; + button_num = (byte)2; break; case Button3: - button_num = 1; + button_num = (byte)1; break; default: return; @@ -210,24 +207,24 @@ putMouseEvent(grab, button_num, state, 0); } - private void putMouseEvent(boolean grab, int button, int state, int dz) { + private void putMouseEvent(boolean grab, byte button, byte state, int dz) { if (grab) putMouseEventWithCoords(button, state, 0, 0, dz); else putMouseEventWithCoords(button, state, last_x, last_y, dz); } - private void handleButtonPress(boolean grab, int button) { + private void handleButtonPress(boolean grab, byte button) { int delta = 0; switch (button) { case Button4: delta = WHEEL_SCALE; - putMouseEvent(grab, -1, 0, delta); + putMouseEvent(grab, (byte)-1, (byte)0, delta); accum_dz += delta; break; case Button5: delta = -WHEEL_SCALE; - putMouseEvent(grab, -1, 0, delta); + putMouseEvent(grab, (byte)-1, (byte)0, delta); accum_dz += delta; break; default: @@ -240,7 +237,7 @@ handleButton(grab, button, (byte)0); } - public void handleButtonEvent(boolean grab, int type, int button) { + public void handleButtonEvent(boolean grab, int type, byte button) { switch (type) { case ButtonRelease: handleButton(grab, button, (byte)0); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -321,7 +321,7 @@ mouse_queue.poll(coord_buffer, buttons_buffer); } - public void readMouse(IntBuffer buffer) { + public void readMouse(ByteBuffer buffer) { mouse_queue.copyEvents(buffer); } @@ -407,7 +407,7 @@ keyboard_queue.poll(keyDownBuffer); } - public void readKeyboard(IntBuffer buffer) { + public void readKeyboard(ByteBuffer buffer) { keyboard_queue.copyEvents(buffer); } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -46,12 +46,11 @@ import java.nio.IntBuffer; import org.lwjgl.BufferUtils; +import org.lwjgl.input.Mouse; final class MouseEventQueue extends EventQueue implements MouseListener, MouseMotionListener, MouseWheelListener { - private static final int WHEEL_SCALE = 120; public static final int NUM_BUTTONS = 3; - private static final int EVENT_SIZE = 5; private final int width; private final int height; @@ -73,13 +72,13 @@ private boolean saved_control_state; /** Event scratch array */ - private final int[] event = new int[EVENT_SIZE]; + private final ByteBuffer event = ByteBuffer.allocate(Mouse.EVENT_SIZE); /** Buttons array */ private final byte[] buttons = new byte[NUM_BUTTONS]; MouseEventQueue(int width, int height) { - super(EVENT_SIZE); + super(Mouse.EVENT_SIZE); this.width = width; this.height = height; resetCursorToCenter(); @@ -105,20 +104,18 @@ ((MacOSXDisplay)Display.getImplementation()).getMouseDeltas(delta_buffer); } - private boolean putMouseEvent(int button, int state, int dz) { - if ( grabbed ) - return putMouseEventWithCoords(button, state, 0, 0, dz); + private void putMouseEvent(byte button, byte state, int dz) { + if (grabbed) + putMouseEventWithCoords(button, state, 0, 0, dz); else - return putMouseEventWithCoords(button, state, last_x, last_y, dz); + putMouseEventWithCoords(button, state, last_x, last_y, dz); } - private boolean putMouseEventWithCoords(int button, int state, int coord1, int coord2, int dz) { - event[0] = button; - event[1] = state; - event[2] = coord1; - event[3] = coord2; - event[4] = dz; - return putEvent(event); + private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz) { + event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz); + event.flip(); + putEvent(event); + event.compact(); } public synchronized void poll(IntBuffer coord_buffer, ByteBuffer buttons_buffer) { @@ -146,7 +143,7 @@ accum_dy += dy; last_x = x; last_y = y; - putMouseEventWithCoords(-1, 0, x, y, 0); + putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0); } public void mouseClicked(MouseEvent e) { @@ -232,7 +229,7 @@ private synchronized void handleWheel(int amount) { accum_dz += amount; - putMouseEvent(-1, 0, amount); + putMouseEvent((byte)-1, (byte)0, amount); } private void updateDeltas() { @@ -243,7 +240,7 @@ int dx = delta_buffer.get(0); int dy = -delta_buffer.get(1); if ( dx != 0 || dy != 0 ) { - putMouseEventWithCoords(-1, 0, dx, dy, 0); + putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0); accum_dx += dx; accum_dy += dy; } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -206,7 +206,7 @@ mouse.poll(coord_buffer, buttons); } - public void readMouse(IntBuffer buffer) { + public void readMouse(ByteBuffer buffer) { update(); mouse.read(buffer); } @@ -251,7 +251,7 @@ keyboard.poll(keyDownBuffer); } - public void readKeyboard(IntBuffer buffer) { + public void readKeyboard(ByteBuffer buffer) { update(); keyboard.read(buffer); } @@ -340,7 +340,7 @@ private static void handleMouseButton(int button, int state) { if (mouse != null) - mouse.handleMouseButton(button, state); + mouse.handleMouseButton((byte)button, (byte)state); } private static void handleMouseMoved(int x, int y) { Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -103,14 +103,13 @@ } } - private void translateData(IntBuffer src, IntBuffer dst) { - int dst_index = dst.position(); + private void translateData(IntBuffer src, ByteBuffer dst) { while (dst.hasRemaining() && src.hasRemaining()) { int dwOfs = src.get(); - dst.put(dwOfs); - int dwData = src.get(); - dst.put(dwData); + dst.putInt(dwOfs); + byte dwData = (byte)src.get(); boolean key_down = (dwData & 0x80) != 0; + dst.put(key_down ? (byte)1 : (byte)0); if (key_down) { int virt_key = MapVirtualKey(dwOfs, 1); if (virt_key != 0 && GetKeyboardState(keyboard_state) != 0) { @@ -126,28 +125,28 @@ int current_char = 0; do { if (current_char >= 1) { - dst.put(0); - dst.put(0); + dst.putInt(0); + dst.put((byte)0); } int char_int = ((int)unicode_buffer.get()) & 0xFFFF; - dst.put(char_int); + dst.putInt(char_int); current_char++; } while (dst.hasRemaining() && current_char < num_chars); } else { - dst.put(0); + dst.putInt(0); } } else { - dst.put(0); + dst.putInt(0); } } else - dst.put(0); + dst.putInt(0); } } private static native int MapVirtualKey(int uCode, int uMapType); private static native int ToUnicode(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, CharBuffer pwszBuff, int cchBuff, int flags); private static native int GetKeyboardState(ByteBuffer lpKeyState); - public void read(IntBuffer buffer) { + public void read(ByteBuffer buffer) { int ret = keyboard.acquire(); if (ret != WindowsDirectInput.DI_OK && ret != WindowsDirectInput.DI_NOEFFECT) return; Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java 2006-07-03 21:53:10 UTC (rev 2432) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java 2006-07-03 23:16:26 UTC (rev 2433) @@ -43,11 +43,11 @@ import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.BufferUtils; +import org.lwjgl.input.Mouse; final class WindowsMouse { private final static int BUFFER_SIZE = 50; private final static int BUTTON_STATES_SIZE = 7; - private final static int MOUSE_EVENT_SIZE = 5; private final static int DIMOFS_X = 0; private final static int DIMOFS_Y = 4; @@ -64,12 +64,12 @@ private final int mouse_button_count; private final boolean has_wheel; - private final EventQueue event_queue = new EventQueue(MOUSE_EVENT_SIZE); + private final EventQueue event_queue = new EventQueue(Mouse.EVENT_SIZE); /* Buffer to hold a DIMOUSESTATE */ private final ByteBuffer mouse_state; private final IntBuffer temp_data_buffer; - private final int[] mouse_event = new int[MOUSE_EVENT_SIZE]; + private final ByteBuffer mouse_event = ByteBuffer.allocate(Mouse.EVENT_SIZE); private boolean mouse_grabbed; private byte[] win32_message_button_states = new byte[BUTTON_STATES_SIZE]; @@ -180,46 +180,44 @@ } } - private boolean putMouseEventWithCoords(int button, int state, int coord1, int coord2, int dz) { - mouse_event[0] = button; - mouse_event[1] = state; - mouse_event[2] = coord1; - mouse_event[3] = coord2; - mouse_event[4] = dz; - return event_queue.putEvent(mouse_event); + private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz) { + mouse_event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz); + mouse_event.flip(); + event_queue.putEvent(mouse_event); + mouse_event.compact(); } - private boolean putMouseEvent(int button, int state, int dz) { + private void putMouseEvent(byte button, byte state, int dz) { if (mouse_grabbed) - return putMouseEventWithCoords(button, state, 0, 0, dz); + putMouseEventWithCoords(button, state, 0, 0, dz); else - return putMouseEventWithCoords(button, state, last_x, last_y, dz); + putMouseEventWithCoords(button, state, last_x, last_y, dz); } private void copyDXEvents(IntBuffer buffer) { int buffer_index = 0; int dx = 0, dy = 0, dwheel = 0; - int button_state; + byte button_state; int i; while (buffer.hasRemaining()) { int dwOfs = buffer.get(); int dwData = buffer.get(); - button_state = (dwData & 0x80) != 0 ? 1 : 0; + button_state = (dwData & 0x80) != 0 ? (byte)1 : (byte)0; switch (dwOfs) { case DIMOFS_BUTTON0: - putMouseEventWithCoords(0, button_state, dx, -dy, dwheel); + putMouseEventWithCoords((byte)0, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON1: - putMouseEventWithCoords(1, button_state, dx, -dy, dwheel); + putMouseEventWithCoords((byte)1, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON2: - putMouseEventWithCoords(2, button_state, dx, -dy, dwheel); + putMouseEventWithCoords((byte)2, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON3: - putMouseEventWithCoords(3, button_state, dx, -dy, dwheel); + putMouseEventWithCoords((byte)3, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_X: @@ -234,7 +232,7 @@ } } if (dx != 0 || dy != 0 || dwheel != 0) - putMouseEventWithCoords(-1, 0, dx, -dy, dwheel); + putMouseEventWithCoords((byte)-1, (byte)0, dx, -dy, dwheel); } private void readDXBuffer() { @@ -261,7 +259,7 @@ } } - public void read(IntBuffer buffer) { + public void read(ByteBuffer buffer) { readDXBuffer(); event_queue.copyEvents(buffer); } @@ -288,7 +286,7 @@ public void handleMouseScrolled(int event_dwheel) { accum_dwheel += event_dwheel; - putMouseEvent(-1, 0, event_dwheel); + putMouseEvent((byte)-1, (byte)0, event_dwheel); } public void handleMouseMoved(int x, int y) { @@ -299,13 +297,13 @@ last_x = x; last_y = y; if (mouse_grabbed) { - putMouseEventWithCoords(-1, 0, dx, dy, 0); + putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0); } else { - putMouseEventWithCoords(-1, 0, x, y, 0); + putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0); } } - public void handleMouseButton(int button, int state) { + public void handleMouseButton(byte button, byte state) { putMouseEvent(button, state, 0); if (button < BUTTON_STATES_SIZE) win32_message_button_states[button] = state != 0 ? (byte)1 : (byte)0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-10-27 06:28:12
|
Revision: 2615
http://svn.sourceforge.net/java-game-lib/?rev=2615&view=rev
Author: elias_naur
Date: 2006-10-26 23:27:58 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Fixed potential NPE from Cursor.getCapabilities()
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java 2006-10-27 06:04:55 UTC (rev 2614)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Cursor.java 2006-10-27 06:27:58 UTC (rev 2615)
@@ -141,7 +141,10 @@
* @return A bit mask with native cursor capabilities.
*/
public static int getCapabilities() {
- return Mouse.getImplementation().getNativeCursorCapabilities();
+ if (Mouse.getImplementation() != null)
+ return Mouse.getImplementation().getNativeCursorCapabilities();
+ else
+ return Mouse.createImplementation().getNativeCursorCapabilities();
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-10-27 06:04:55 UTC (rev 2614)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-10-27 06:27:58 UTC (rev 2615)
@@ -307,6 +307,8 @@
* @throws LWJGLException if the keyboard could not be created for any reason
*/
public static void create() throws LWJGLException {
+ if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
+
create(Mouse.createImplementation());
}
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-10-27 06:04:55 UTC (rev 2614)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-10-27 06:27:58 UTC (rev 2615)
@@ -225,8 +225,6 @@
}
static InputImplementation createImplementation() {
- if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
-
/* Use reflection since we can't make Display.getImplementation
* public
*/
@@ -278,6 +276,8 @@
* @throws LWJGLException if the mouse could not be created for any reason
*/
public static void create() throws LWJGLException {
+ if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
+
create(createImplementation());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-11-16 12:29:54
|
Revision: 2646
http://svn.sourceforge.net/java-game-lib/?rev=2646&view=rev
Author: elias_naur
Date: 2006-11-16 04:29:52 -0800 (Thu, 16 Nov 2006)
Log Message:
-----------
Restore old Mouse.create/Keyboard.create behavior which is to ignore create() when already created.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-11-15 18:46:22 UTC (rev 2645)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-11-16 12:29:52 UTC (rev 2646)
@@ -290,7 +290,7 @@
*/
private static void create(InputImplementation impl) throws LWJGLException {
if (created)
- throw new IllegalStateException("Destroy the Keyboard first.");
+ return;
if (!initialized)
initialize();
implementation = impl;
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-11-15 18:46:22 UTC (rev 2645)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-11-16 12:29:52 UTC (rev 2646)
@@ -249,7 +249,7 @@
*/
private static void create(InputImplementation impl) throws LWJGLException {
if (created)
- throw new IllegalStateException("Destroy the mouse first.");
+ return;
if (!initialized)
initialize();
implementation = impl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-11-24 10:18:41
|
Revision: 2676
http://svn.sourceforge.net/java-game-lib/?rev=2676&view=rev
Author: elias_naur
Date: 2006-11-24 02:18:36 -0800 (Fri, 24 Nov 2006)
Log Message:
-----------
Synchronize Keyboard and Mouse to avoid problems with AWTInputAdapter based usage
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-11-20 20:07:29 UTC (rev 2675)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-11-24 10:18:36 UTC (rev 2676)
@@ -306,7 +306,7 @@
*
* @throws LWJGLException if the keyboard could not be created for any reason
*/
- public static void create() throws LWJGLException {
+ public static synchronized void create() throws LWJGLException {
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
create(Mouse.createImplementation());
@@ -324,14 +324,14 @@
/**
* @return true if the keyboard has been created
*/
- public static boolean isCreated() {
+ public static synchronized boolean isCreated() {
return created;
}
/**
* "Destroy" the keyboard
*/
- public static void destroy() {
+ public static synchronized void destroy() {
if (!created)
return;
created = false;
@@ -357,7 +357,7 @@
* @see org.lwjgl.input.Keyboard#getEventKeyState()
* @see org.lwjgl.input.Keyboard#getEventCharacter()
*/
- public static void poll() {
+ public static synchronized void poll() {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can poll the device");
implementation.pollKeyboard(keyDownBuffer);
@@ -375,7 +375,7 @@
* @param key Keycode to check
* @return true if the key is down according to the last poll()
*/
- public static boolean isKeyDown(int key) {
+ public static synchronized boolean isKeyDown(int key) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can query key state");
return keyDownBuffer.get(key) != 0;
@@ -398,7 +398,7 @@
* @param key The key
* @return a String with the key's human readable name in it or null if the key is unnamed
*/
- public static String getKeyName(int key) {
+ public static synchronized String getKeyName(int key) {
return keyName[key];
}
@@ -406,7 +406,7 @@
* Get's a key's index. If the key is unrecognised then KEY_NONE is returned.
* @param keyName The key name
*/
- public static int getKeyIndex(String keyName) {
+ public static synchronized int getKeyIndex(String keyName) {
Integer ret = (Integer) keyMap.get(keyName);
if (ret == null)
return KEY_NONE;
@@ -418,7 +418,7 @@
* Gets the number of keyboard events waiting after doing a buffer enabled poll().
* @return the number of keyboard events
*/
- public static int getNumKeyboardEvents() {
+ public static synchronized int getNumKeyboardEvents() {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
return readBuffer.remaining()/EVENT_SIZE;
@@ -435,7 +435,7 @@
* @see org.lwjgl.input.Keyboard#getEventCharacter()
* @return true if a keyboard event was read, false otherwise
*/
- public static boolean next() {
+ public static synchronized boolean next() {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
@@ -453,14 +453,14 @@
/**
* @return Number of keys on this keyboard
*/
- public static int getKeyCount() {
+ public static synchronized int getKeyCount() {
return keyCount;
}
/**
* @return The character from the current event
*/
- public static char getEventCharacter() {
+ public static synchronized char getEventCharacter() {
return (char)eventCharacter;
}
@@ -471,7 +471,7 @@
*
* @return The key from the current event
*/
- public static int getEventKey() {
+ public static synchronized int getEventKey() {
return eventKey;
}
@@ -481,7 +481,7 @@
*
* @return True if key was down, or false if released
*/
- public static boolean getEventKeyState() {
+ public static synchronized boolean getEventKeyState() {
return eventState;
}
@@ -492,7 +492,7 @@
* origin.
* @return The time in nanoseconds of the current event
*/
- public static long getEventNanoseconds() {
+ public static synchronized long getEventNanoseconds() {
return eventNanos;
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-11-20 20:07:29 UTC (rev 2675)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-11-24 10:18:36 UTC (rev 2676)
@@ -150,7 +150,7 @@
*
* @return the currently bound native cursor, if any.
*/
- public static Cursor getNativeCursor() {
+ public static synchronized Cursor getNativeCursor() {
return currentCursor;
}
@@ -165,7 +165,7 @@
* @return The previous Cursor object set, or null.
* @throws LWJGLException if the cursor could not be set for any reason
*/
- public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
+ public static synchronized Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0)
throw new IllegalStateException("Mouse doesn't support native cursors");
Cursor oldCursor = currentCursor;
@@ -190,7 +190,7 @@
* @param y The y coordinate of the new cursor position in OpenGL coordinates relative
* to the window origin.
*/
- public static void setCursorPosition(int new_x, int new_y) {
+ public static synchronized void setCursorPosition(int new_x, int new_y) {
if (!isCreated())
throw new IllegalStateException("Mouse is not created");
x = event_x = new_x;
@@ -275,7 +275,7 @@
*
* @throws LWJGLException if the mouse could not be created for any reason
*/
- public static void create() throws LWJGLException {
+ public static synchronized void create() throws LWJGLException {
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
create(createImplementation());
@@ -284,14 +284,14 @@
/**
* @return true if the mouse has been created
*/
- public static boolean isCreated() {
+ public static synchronized boolean isCreated() {
return created;
}
/**
* "Destroy" the mouse.
*/
- public static void destroy() {
+ public static synchronized void destroy() {
if (!created) return;
created = false;
buttons = null;
@@ -321,7 +321,7 @@
* @see org.lwjgl.input.Mouse#getDY()
* @see org.lwjgl.input.Mouse#getDWheel()
*/
- public static void poll() {
+ public static synchronized void poll() {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
implementation.pollMouse(coord_buffer, buttons);
@@ -360,7 +360,7 @@
* @param button The index of the button you wish to test (0..getButtonCount-1)
* @return true if the specified button is down
*/
- public static boolean isButtonDown(int button) {
+ public static synchronized boolean isButtonDown(int button) {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll the button state");
if (button >= buttonCount || button < 0)
return false;
@@ -373,7 +373,7 @@
* @param button The button
* @return a String with the button's human readable name in it or null if the button is unnamed
*/
- public static String getButtonName(int button) {
+ public static synchronized String getButtonName(int button) {
if (button >= buttonName.length || button < 0)
return null;
else
@@ -384,7 +384,7 @@
* Get's a button's index. If the button is unrecognised then -1 is returned.
* @param buttonName The button name
*/
- public static int getButtonIndex(String buttonName) {
+ public static synchronized int getButtonIndex(String buttonName) {
Integer ret = (Integer) buttonMap.get(buttonName);
if (ret == null)
return -1;
@@ -401,7 +401,7 @@
* @see org.lwjgl.input.Mouse#getEventButtonState()
* @return true if a mouse event was read, false otherwise
*/
- public static boolean next() {
+ public static synchronized boolean next() {
if (!created) throw new IllegalStateException("Mouse must be created before you can read events");
if (readBuffer.hasRemaining()) {
eventButton = readBuffer.get();
@@ -431,7 +431,7 @@
/**
* @return Current events button. Returns -1 if no button state was changed
*/
- public static int getEventButton() {
+ public static synchronized int getEventButton() {
return eventButton;
}
@@ -439,42 +439,42 @@
* Get the current events button state.
* @return Current events button state.
*/
- public static boolean getEventButtonState() {
+ public static synchronized boolean getEventButtonState() {
return eventState;
}
/**
* @return Current events delta x. Only valid when the mouse is grabbed.
*/
- public static int getEventDX() {
+ public static synchronized int getEventDX() {
return event_dx;
}
/**
* @return Current events delta y. Only valid when the mouse is grabbed.
*/
- public static int getEventDY() {
+ public static synchronized int getEventDY() {
return event_dy;
}
/**
* @return Current events absolute x. Only valid when the mouse is not grabbed.
*/
- public static int getEventX() {
+ public static synchronized int getEventX() {
return event_x;
}
/**
* @return Current events absolute y. Only valid when the mouse is not grabbed.
*/
- public static int getEventY() {
+ public static synchronized int getEventY() {
return event_y;
}
/**
* @return Current events delta z
*/
- public static int getEventDWheel() {
+ public static synchronized int getEventDWheel() {
return event_dwheel;
}
@@ -486,7 +486,7 @@
*
* @return The time in nanoseconds of the current event
*/
- public static long getEventNanoseconds() {
+ public static synchronized long getEventNanoseconds() {
return event_nanos;
}
@@ -496,7 +496,7 @@
*
* @return Absolute x axis position of mouse
*/
- public static int getX() {
+ public static synchronized int getX() {
return x;
}
@@ -506,14 +506,14 @@
*
* @return Absolute y axis position of mouse
*/
- public static int getY() {
+ public static synchronized int getY() {
return y;
}
/**
* @return Movement on the x axis since last time getDX() was called. Only valid when the mouse is grabbed.
*/
- public static int getDX() {
+ public static synchronized int getDX() {
int result = dx;
dx = 0;
return result;
@@ -522,7 +522,7 @@
/**
* @return Movement on the y axis since last time getDY() was called. Only valid when the mouse is grabbed.
*/
- public static int getDY() {
+ public static synchronized int getDY() {
int result = dy;
dy = 0;
return result;
@@ -531,7 +531,7 @@
/**
* @return Movement of the wheel since last time getDWheel() was called
*/
- public static int getDWheel() {
+ public static synchronized int getDWheel() {
int result = dwheel;
dwheel = 0;
return result;
@@ -540,21 +540,21 @@
/**
* @return Number of buttons on this mouse
*/
- public static int getButtonCount() {
+ public static synchronized int getButtonCount() {
return buttonCount;
}
/**
* @return Whether or not this mouse has wheel support
*/
- public static boolean hasWheel() {
+ public static synchronized boolean hasWheel() {
return hasWheel;
}
/**
* @return whether or not the mouse has grabbed the cursor
*/
- public static boolean isGrabbed() {
+ public static synchronized boolean isGrabbed() {
return isGrabbed;
}
@@ -566,7 +566,7 @@
*
* @param grab whether the mouse should be grabbed
*/
- public static void setGrabbed(boolean grab) {
+ public static synchronized void setGrabbed(boolean grab) {
isGrabbed = grab;
if (isCreated()) {
implementation.grabMouse(isGrabbed);
@@ -579,7 +579,7 @@
* This method is called automatically by the window on its update, and
* shouldn't be called otherwise
*/
- public static void updateCursor() {
+ public static synchronized void updateCursor() {
if (isWindows && currentCursor != null && currentCursor.hasTimedOut()) {
currentCursor.nextCursor();
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-05-30 20:33:48
|
Revision: 2833
http://svn.sourceforge.net/java-game-lib/?rev=2833&view=rev
Author: elias_naur
Date: 2007-05-30 13:33:40 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Removed unnecessary (and deadlock prone) synchronized modifiers from methods in Keyboard and Mouse
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2007-05-27 15:32:25 UTC (rev 2832)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2007-05-30 20:33:40 UTC (rev 2833)
@@ -303,7 +303,7 @@
*
* @throws LWJGLException if the keyboard could not be created for any reason
*/
- public static synchronized void create() throws LWJGLException {
+ public static void create() throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
@@ -321,7 +321,7 @@
/**
* @return true if the keyboard has been created
*/
- public static synchronized boolean isCreated() {
+ public static boolean isCreated() {
synchronized (OpenGLPackageAccess.global_lock) {
return created;
}
@@ -330,7 +330,7 @@
/**
* "Destroy" the keyboard
*/
- public static synchronized void destroy() {
+ public static void destroy() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
return;
@@ -358,7 +358,7 @@
* @see org.lwjgl.input.Keyboard#getEventKeyState()
* @see org.lwjgl.input.Keyboard#getEventCharacter()
*/
- public static synchronized void poll() {
+ public static void poll() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can poll the device");
@@ -378,7 +378,7 @@
* @param key Keycode to check
* @return true if the key is down according to the last poll()
*/
- public static synchronized boolean isKeyDown(int key) {
+ public static boolean isKeyDown(int key) {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can query key state");
@@ -423,7 +423,7 @@
* Gets the number of keyboard events waiting after doing a buffer enabled poll().
* @return the number of keyboard events
*/
- public static synchronized int getNumKeyboardEvents() {
+ public static int getNumKeyboardEvents() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
@@ -447,7 +447,7 @@
* @see org.lwjgl.input.Keyboard#getEventCharacter()
* @return true if a keyboard event was read, false otherwise
*/
- public static synchronized boolean next() {
+ public static boolean next() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
@@ -467,8 +467,10 @@
*
* @see org.lwjgl.input.Keyboard#getEventKey()
*/
- public static synchronized void enableRepeatEvents(boolean enable) {
- repeat_enabled = enable;
+ public static void enableRepeatEvents(boolean enable) {
+ synchronized (OpenGLPackageAccess.global_lock) {
+ repeat_enabled = enable;
+ }
}
/**
@@ -477,8 +479,10 @@
* @return true is repeat events are reported, false if not.
* @see org.lwjgl.input.Keyboard#getEventKey()
*/
- public static synchronized boolean areRepeatEventsEnabled() {
- return repeat_enabled;
+ public static boolean areRepeatEventsEnabled() {
+ synchronized (OpenGLPackageAccess.global_lock) {
+ return repeat_enabled;
+ }
}
private static boolean readNext(KeyEvent event) {
@@ -496,16 +500,14 @@
/**
* @return Number of keys on this keyboard
*/
- public static synchronized int getKeyCount() {
- synchronized (OpenGLPackageAccess.global_lock) {
- return keyCount;
- }
+ public static int getKeyCount() {
+ return keyCount;
}
/**
* @return The character from the current event
*/
- public static synchronized char getEventCharacter() {
+ public static char getEventCharacter() {
synchronized (OpenGLPackageAccess.global_lock) {
return (char)current_event.character;
}
@@ -518,7 +520,7 @@
*
* @return The key from the current event
*/
- public static synchronized int getEventKey() {
+ public static int getEventKey() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.key;
}
@@ -530,7 +532,7 @@
*
* @return True if key was down, or false if released
*/
- public static synchronized boolean getEventKeyState() {
+ public static boolean getEventKeyState() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.state;
}
@@ -543,7 +545,7 @@
* origin.
* @return The time in nanoseconds of the current event
*/
- public static synchronized long getEventNanoseconds() {
+ public static long getEventNanoseconds() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.nanos;
}
@@ -554,7 +556,7 @@
* @return true if the current event is a repeat event, false if
* the current event is not a repeat even or if repeat events are disabled.
*/
- public static synchronized boolean isRepeatEvent() {
+ public static boolean isRepeatEvent() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.repeat;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2007-05-27 15:32:25 UTC (rev 2832)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2007-05-30 20:33:40 UTC (rev 2833)
@@ -146,7 +146,7 @@
*
* @return the currently bound native cursor, if any.
*/
- public static synchronized Cursor getNativeCursor() {
+ public static Cursor getNativeCursor() {
synchronized (OpenGLPackageAccess.global_lock) {
return currentCursor;
}
@@ -163,7 +163,7 @@
* @return The previous Cursor object set, or null.
* @throws LWJGLException if the cursor could not be set for any reason
*/
- public static synchronized Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
+ public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0)
throw new IllegalStateException("Mouse doesn't support native cursors");
@@ -190,7 +190,7 @@
* @param y The y coordinate of the new cursor position in OpenGL coordinates relative
* to the window origin.
*/
- public static synchronized void setCursorPosition(int new_x, int new_y) {
+ public static void setCursorPosition(int new_x, int new_y) {
synchronized (OpenGLPackageAccess.global_lock) {
if (!isCreated())
throw new IllegalStateException("Mouse is not created");
@@ -260,7 +260,7 @@
*
* @throws LWJGLException if the mouse could not be created for any reason
*/
- public static synchronized void create() throws LWJGLException {
+ public static void create() throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
@@ -271,7 +271,7 @@
/**
* @return true if the mouse has been created
*/
- public static synchronized boolean isCreated() {
+ public static boolean isCreated() {
synchronized (OpenGLPackageAccess.global_lock) {
return created;
}
@@ -280,7 +280,7 @@
/**
* "Destroy" the mouse.
*/
- public static synchronized void destroy() {
+ public static void destroy() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) return;
created = false;
@@ -312,7 +312,7 @@
* @see org.lwjgl.input.Mouse#getDY()
* @see org.lwjgl.input.Mouse#getDWheel()
*/
- public static synchronized void poll() {
+ public static void poll() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
implementation.pollMouse(coord_buffer, buttons);
@@ -353,7 +353,7 @@
* @param button The index of the button you wish to test (0..getButtonCount-1)
* @return true if the specified button is down
*/
- public static synchronized boolean isButtonDown(int button) {
+ public static boolean isButtonDown(int button) {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll the button state");
if (button >= buttonCount || button < 0)
@@ -368,7 +368,7 @@
* @param button The button
* @return a String with the button's human readable name in it or null if the button is unnamed
*/
- public static synchronized String getButtonName(int button) {
+ public static String getButtonName(int button) {
synchronized (OpenGLPackageAccess.global_lock) {
if (button >= buttonName.length || button < 0)
return null;
@@ -381,7 +381,7 @@
* Get's a button's index. If the button is unrecognised then -1 is returned.
* @param buttonName The button name
*/
- public static synchronized int getButtonIndex(String buttonName) {
+ public static int getButtonIndex(String buttonName) {
synchronized (OpenGLPackageAccess.global_lock) {
Integer ret = (Integer) buttonMap.get(buttonName);
if (ret == null)
@@ -400,7 +400,7 @@
* @see org.lwjgl.input.Mouse#getEventButtonState()
* @return true if a mouse event was read, false otherwise
*/
- public static synchronized boolean next() {
+ public static boolean next() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) throw new IllegalStateException("Mouse must be created before you can read events");
if (readBuffer.hasRemaining()) {
@@ -432,7 +432,7 @@
/**
* @return Current events button. Returns -1 if no button state was changed
*/
- public static synchronized int getEventButton() {
+ public static int getEventButton() {
synchronized (OpenGLPackageAccess.global_lock) {
return eventButton;
}
@@ -442,7 +442,7 @@
* Get the current events button state.
* @return Current events button state.
*/
- public static synchronized boolean getEventButtonState() {
+ public static boolean getEventButtonState() {
synchronized (OpenGLPackageAccess.global_lock) {
return eventState;
}
@@ -451,7 +451,7 @@
/**
* @return Current events delta x. Only valid when the mouse is grabbed.
*/
- public static synchronized int getEventDX() {
+ public static int getEventDX() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_dx;
}
@@ -460,7 +460,7 @@
/**
* @return Current events delta y. Only valid when the mouse is grabbed.
*/
- public static synchronized int getEventDY() {
+ public static int getEventDY() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_dy;
}
@@ -469,7 +469,7 @@
/**
* @return Current events absolute x. Only valid when the mouse is not grabbed.
*/
- public static synchronized int getEventX() {
+ public static int getEventX() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_x;
}
@@ -478,7 +478,7 @@
/**
* @return Current events absolute y. Only valid when the mouse is not grabbed.
*/
- public static synchronized int getEventY() {
+ public static int getEventY() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_y;
}
@@ -487,7 +487,7 @@
/**
* @return Current events delta z
*/
- public static synchronized int getEventDWheel() {
+ public static int getEventDWheel() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_dwheel;
}
@@ -501,7 +501,7 @@
*
* @return The time in nanoseconds of the current event
*/
- public static synchronized long getEventNanoseconds() {
+ public static long getEventNanoseconds() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_nanos;
}
@@ -513,7 +513,7 @@
*
* @return Absolute x axis position of mouse
*/
- public static synchronized int getX() {
+ public static int getX() {
synchronized (OpenGLPackageAccess.global_lock) {
return x;
}
@@ -525,7 +525,7 @@
*
* @return Absolute y axis position of mouse
*/
- public static synchronized int getY() {
+ public static int getY() {
synchronized (OpenGLPackageAccess.global_lock) {
return y;
}
@@ -534,7 +534,7 @@
/**
* @return Movement on the x axis since last time getDX() was called. Only valid when the mouse is grabbed.
*/
- public static synchronized int getDX() {
+ public static int getDX() {
synchronized (OpenGLPackageAccess.global_lock) {
int result = dx;
dx = 0;
@@ -545,7 +545,7 @@
/**
* @return Movement on the y axis since last time getDY() was called. Only valid when the mouse is grabbed.
*/
- public static synchronized int getDY() {
+ public static int getDY() {
synchronized (OpenGLPackageAccess.global_lock) {
int result = dy;
dy = 0;
@@ -556,7 +556,7 @@
/**
* @return Movement of the wheel since last time getDWheel() was called
*/
- public static synchronized int getDWheel() {
+ public static int getDWheel() {
synchronized (OpenGLPackageAccess.global_lock) {
int result = dwheel;
dwheel = 0;
@@ -567,7 +567,7 @@
/**
* @return Number of buttons on this mouse
*/
- public static synchronized int getButtonCount() {
+ public static int getButtonCount() {
synchronized (OpenGLPackageAccess.global_lock) {
return buttonCount;
}
@@ -576,7 +576,7 @@
/**
* @return Whether or not this mouse has wheel support
*/
- public static synchronized boolean hasWheel() {
+ public static boolean hasWheel() {
synchronized (OpenGLPackageAccess.global_lock) {
return hasWheel;
}
@@ -585,7 +585,7 @@
/**
* @return whether or not the mouse has grabbed the cursor
*/
- public static synchronized boolean isGrabbed() {
+ public static boolean isGrabbed() {
synchronized (OpenGLPackageAccess.global_lock) {
return isGrabbed;
}
@@ -599,7 +599,7 @@
*
* @param grab whether the mouse should be grabbed
*/
- public static synchronized void setGrabbed(boolean grab) {
+ public static void setGrabbed(boolean grab) {
synchronized (OpenGLPackageAccess.global_lock) {
isGrabbed = grab;
if (isCreated()) {
@@ -618,7 +618,7 @@
* This method is called automatically by the window on its update, and
* shouldn't be called otherwise
*/
- public static synchronized void updateCursor() {
+ public static void updateCursor() {
synchronized (OpenGLPackageAccess.global_lock) {
if (emulateCursorAnimation && currentCursor != null && currentCursor.hasTimedOut()) {
currentCursor.nextCursor();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|