Linux: Moved a display connection creation to java
This commit is contained in:
parent
5af5828dc6
commit
6e5ed9d1ff
|
@ -79,20 +79,28 @@ final class LinuxDisplay implements DisplayImplementation {
|
||||||
private static PeerInfo peer_info;
|
private static PeerInfo peer_info;
|
||||||
|
|
||||||
private static int getBestDisplayModeExtension() throws LWJGLException {
|
private static int getBestDisplayModeExtension() throws LWJGLException {
|
||||||
if (System.getenv("LWJGL_DISABLE_XRANDR") == null && isXrandrSupported()) {
|
lockAWT();
|
||||||
LWJGLUtil.log("Using Xrandr for display mode switching");
|
try {
|
||||||
return XRANDR;
|
incDisplay();
|
||||||
} else if (isXF86VidModeSupported()) {
|
int result;
|
||||||
LWJGLUtil.log("Using XF86VidMode for display mode switching");
|
if (System.getenv("LWJGL_DISABLE_XRANDR") == null && isXrandrSupported()) {
|
||||||
return XF86VIDMODE;
|
LWJGLUtil.log("Using Xrandr for display mode switching");
|
||||||
} else {
|
result = XRANDR;
|
||||||
LWJGLUtil.log("No display mode extensions available");
|
} else if (isXF86VidModeSupported()) {
|
||||||
return NONE;
|
LWJGLUtil.log("Using XF86VidMode for display mode switching");
|
||||||
|
result = XF86VIDMODE;
|
||||||
|
} else {
|
||||||
|
LWJGLUtil.log("No display mode extensions available");
|
||||||
|
result = NONE;
|
||||||
|
}
|
||||||
|
decDisplay();
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
unlockAWT();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private static native boolean isXrandrSupported() throws LWJGLException;
|
private static native boolean isXrandrSupported();
|
||||||
private static native boolean isXF86VidModeSupported() throws LWJGLException;
|
private static native boolean isXF86VidModeSupported();
|
||||||
|
|
||||||
private static boolean isNetWMFullscreenSupported() throws LWJGLException {
|
private static boolean isNetWMFullscreenSupported() throws LWJGLException {
|
||||||
if (System.getenv("LWJGL_DISABLE_NETWM") != null)
|
if (System.getenv("LWJGL_DISABLE_NETWM") != null)
|
||||||
|
|
|
@ -130,26 +130,12 @@ static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isXrandrSupported(JNIEnv *env, jclass unused) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isXrandrSupported(JNIEnv *env, jclass unused) {
|
||||||
Display *disp = XOpenDisplay(NULL);
|
jboolean result = isXrandrSupported(env, getDisplay()) ? JNI_TRUE : JNI_FALSE;
|
||||||
if (disp == NULL) {
|
|
||||||
throwException(env, "Could not open display");
|
|
||||||
return JNI_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
|
|
||||||
XCloseDisplay(disp);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isXF86VidModeSupported(JNIEnv *env, jclass unused) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isXF86VidModeSupported(JNIEnv *env, jclass unused) {
|
||||||
Display *disp = XOpenDisplay(NULL);
|
jboolean result = isXF86VidModeSupported(env, getDisplay()) ? JNI_TRUE : JNI_FALSE;
|
||||||
if (disp == NULL) {
|
|
||||||
throwException(env, "Could not open display");
|
|
||||||
return JNI_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE;
|
|
||||||
XCloseDisplay(disp);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue