Linux: Handle different GLX capabilities on different screens

This commit is contained in:
Elias Naur 2005-02-24 10:44:34 +00:00
parent 165084e12d
commit bdcb68a582
9 changed files with 277 additions and 259 deletions

View file

@ -35,6 +35,7 @@ import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.BufferUtils;
import org.lwjgl.Sys;
/**
* $Id$
@ -131,11 +132,16 @@ final class LinuxContextImplementation implements ContextImplementation {
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setVSync(boolean enabled) {
LinuxDisplay.lockAWT();
nSetVSync(enabled);
LinuxDisplay.unlockAWT();
Context current_context = Context.getCurrentContext();
if (current_context == null)
throw new IllegalStateException("No context is current");
synchronized (current_context) {
LinuxDisplay.lockAWT();
nSetVSync(current_context.getHandle(), enabled);
LinuxDisplay.unlockAWT();
}
}
private static native void nSetVSync(boolean enabled);
private static native void nSetVSync(ByteBuffer context_handle, boolean enabled);
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
LinuxDisplay.lockAWT();

View file

@ -359,9 +359,17 @@ final class LinuxDisplay implements DisplayImplementation {
public int getPbufferCapabilities() {
lockAWT();
int caps = nGetPbufferCapabilities();
unlockAWT();
return caps;
try {
incDisplay();
int caps = nGetPbufferCapabilities();
decDisplay();
return caps;
} catch (LWJGLException e) {
Sys.log("Exception occurred in getPbufferCapabilities: " + e);
return 0;
} finally {
unlockAWT();
}
}
private static native int nGetPbufferCapabilities();