Moved processMessages call after swapBuffers in Display.update.

Added option to not call processMessages during Display.update.
This commit is contained in:
Ioannis Tsakpinis 2010-04-03 19:03:49 +00:00
parent 0d01982d5f
commit 3035e3c95c
1 changed files with 20 additions and 9 deletions

View File

@ -648,17 +648,27 @@ public final class Display {
}
/**
* Update the window. This calls processMessages(), and if the window is visible
* clears the dirty flag and calls swapBuffers() and finally polls the input devices.
* Update the window. If the window is visible clears
* the dirty flag and calls swapBuffers() and finally
* polls the input devices.
*
* @throws OpenGLException if an OpenGL error has occured since the last call to GL11.glGetError()
*/
public static void update() {
update(true);
}
/**
* Update the window. If the window is visible clears
* the dirty flag and calls swapBuffers() and finally
* polls the input devices if processMessages is true.
*
* @param processMessages Poll input devices if true
*/
public static void update(boolean processMessages) {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Display not created");
processMessages();
// We paint only when the window is visible or dirty
if ( display_impl.isVisible() || display_impl.isDirty() ) {
try {
@ -667,13 +677,14 @@ public final class Display {
throw new RuntimeException(e);
}
}
if ( swap_interval != 0 ) // Handle events again when vsync is enabled, to reduced input lag.
processMessages();
if ( parent_resized ) {
reshape();
parent_resized = false;
}
if ( processMessages )
processMessages();
}
}