mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-05 14:35:58 +00:00
Linux: Handle different GLX capabilities on different screens
This commit is contained in:
parent
165084e12d
commit
bdcb68a582
9 changed files with 277 additions and 259 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue