Remove AWTInputAdapter.update() and let users poll() Mouse and Keyboard directly
This commit is contained in:
parent
216044ffa4
commit
3a12b4bdd2
|
@ -41,7 +41,6 @@ import org.lwjgl.LWJGLException;
|
|||
*/
|
||||
interface AWTCanvasInputImplementation extends InputImplementation {
|
||||
void processInput(PeerInfo peer_info);
|
||||
void update();
|
||||
void init();
|
||||
void destroy();
|
||||
}
|
||||
|
|
|
@ -94,11 +94,4 @@ public final class AWTInputAdapter {
|
|||
awt_input = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void update() {
|
||||
if (awt_input == null)
|
||||
throw new IllegalStateException("You need to create() the adapter.");
|
||||
awt_input.update();
|
||||
Display.pollDevices();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ final class LinuxAWTInput extends AbstractAWTInput {
|
|||
checkFocus();
|
||||
if (!input_grabbed && shouldGrab())
|
||||
grabInput(new_window);
|
||||
update();
|
||||
} finally {
|
||||
LinuxDisplay.unlockAWT();
|
||||
}
|
||||
|
@ -150,21 +151,16 @@ final class LinuxAWTInput extends AbstractAWTInput {
|
|||
return !input_released && isGrabbed();
|
||||
}
|
||||
|
||||
public synchronized void update() {
|
||||
LinuxDisplay.lockAWT();
|
||||
try {
|
||||
private void update() {
|
||||
while (LinuxEvent.getPending(display) > 0) {
|
||||
event.nextEvent(display);
|
||||
if (shouldGrab()) {
|
||||
long event_window = event.getWindow();
|
||||
boolean processed = event.filterEvent(event_window) ||
|
||||
cached_mouse.filterEvent(isGrabbed(), shouldGrab(), event)/* ||
|
||||
cached_keyboard.filterEvent(event)*/;
|
||||
cached_mouse.filterEvent(isGrabbed(), shouldGrab(), event);/* ||
|
||||
cached_keyboard.filterEvent(event) */
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
LinuxDisplay.unlockAWT();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void grabMouse(boolean grab) {
|
||||
|
|
|
@ -63,7 +63,4 @@ final class MacOSXAWTInput extends AbstractAWTInput {
|
|||
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
public void update() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,9 +129,6 @@ final class WindowsAWTInput extends AbstractAWTInput {
|
|||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
}
|
||||
|
||||
public synchronized void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
|
||||
if (isGrabbed()) {
|
||||
if (cached_mouse != null)
|
||||
|
|
|
@ -140,11 +140,12 @@ public class AWTInputAdapterTest extends Frame {
|
|||
+ (fps / (timeUsed / 1000f)));
|
||||
fps = 0;
|
||||
}
|
||||
AWTInputAdapter.update();
|
||||
Mouse.poll();
|
||||
while (Mouse.next()) {
|
||||
view_roty += Mouse.getEventDX()*.1;
|
||||
view_rotx -= Mouse.getEventDY()*.1;
|
||||
}
|
||||
Keyboard.poll();
|
||||
while (Keyboard.next()) {
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
switch (Keyboard.getEventKey()) {
|
||||
|
|
Loading…
Reference in New Issue