diff options
Diffstat (limited to 'src/nativewindow')
4 files changed, 20 insertions, 9 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java index b43db8292..e2e1c5a82 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java @@ -131,7 +131,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { // Don't substitute a positive score for a smaller negative score if ((scoreClosestToZero == NO_SCORE) || (Math.abs(score) < Math.abs(scoreClosestToZero) && - ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { + ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { scoreClosestToZero = score; chosenIndex = i; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index b0f5cb3f9..51f4568c8 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -200,7 +200,7 @@ public abstract class NativeWindowFactory { } }); if(null != jawtUtilClass && null != jawtUtilGetJAWTToolkitMethod && null != jawtUtilInitMethod) { - ReflectionUtil.callMethod(null, jawtUtilInitMethod, null); + ReflectionUtil.callMethod(null, jawtUtilInitMethod); Object resO = ReflectionUtil.callStaticMethod(JAWTUtilClassName, "isHeadlessMode", null, null, cl ); if(resO instanceof Boolean) { @@ -329,7 +329,7 @@ public abstract class NativeWindowFactory { } protected static ToolkitLock getAWTToolkitLock() { - Object resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitMethod, null); + Object resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitMethod); if(resO instanceof ToolkitLock) { return (ToolkitLock) resO; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java index 96a45b7b1..0d992d7fa 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java @@ -89,7 +89,7 @@ public class Insets implements Cloneable { } public String toString() { - return getClass().getName() + "[top=" + top + ",left=" + left + + return getClass().getName() + "[top=" + top + ",left=" + left + ",bottom=" + bottom + ",right=" + right + "]"; } diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c index 1ced0fff4..1ee0a645b 100644 --- a/src/nativewindow/native/x11/Xmisc.c +++ b/src/nativewindow/native/x11/Xmisc.c @@ -154,7 +154,18 @@ static void _initClazzAccess(JNIEnv *env) { } } -static JNIEnv * x11ErrorHandlerJNIEnv = NULL; +static JavaVM *jvmHandle = NULL; +static int jvmVersion = 0; +static JNIEnv * jvmEnv = NULL; + +static void setupJVMVars(JNIEnv * env) { + if(0 != (*env)->GetJavaVM(env, &jvmHandle)) { + jvmHandle = NULL; + } + jvmVersion = (*env)->GetVersion(env); + jvmEnv = env; +} + static XErrorHandler origErrorHandler = NULL ; static int errorHandlerBlocked = 0 ; static int errorHandlerQuiet = 0 ; @@ -168,7 +179,7 @@ static int x11ErrorHandler(Display *dpy, XErrorEvent *e) // Since the X11 Error may happen anytime, a exception could mess up the JVM completely. // Experienced this for remote displays issuing non supported commands, eg. glXCreateContextAttribsARB(..) // - NativewindowCommon_throwNewRuntimeException(x11ErrorHandlerJNIEnv, "Info: Nativewindow X11 Error: Display %p, Code 0x%X, errno %s", + NativewindowCommon_throwNewRuntimeException(jvmEnv, "Info: Nativewindow X11 Error: Display %p, Code 0x%X, errno %s", dpy, e->error_code, strerror(errno)); #endif @@ -186,7 +197,7 @@ static void x11ErrorHandlerEnable(Display *dpy, int onoff, JNIEnv * env) { if(onoff) { if(NULL==origErrorHandler) { - x11ErrorHandlerJNIEnv = env; + setupJVMVars(env); if(NULL!=dpy) { XSync(dpy, False); } @@ -216,7 +227,7 @@ static XIOErrorHandler origIOErrorHandler = NULL; static int x11IOErrorHandler(Display *dpy) { fprintf(stderr, "Nativewindow X11 IOError: Display %p (%s): %s\n", dpy, XDisplayName(NULL), strerror(errno)); - // NativewindowCommon_FatalError(x11ErrorHandlerJNIEnv, "Nativewindow X11 IOError: Display %p (%s): %s", dpy, XDisplayName(NULL), strerror(errno)); + // NativewindowCommon_FatalError(jvmEnv, "Nativewindow X11 IOError: Display %p (%s): %s", dpy, XDisplayName(NULL), strerror(errno)); if(NULL!=origIOErrorHandler) { origIOErrorHandler(dpy); } @@ -226,7 +237,7 @@ static int x11IOErrorHandler(Display *dpy) static void x11IOErrorHandlerEnable(int onoff, JNIEnv * env) { if(onoff) { if(NULL==origIOErrorHandler) { - x11ErrorHandlerJNIEnv = env; + setupJVMVars(env); origIOErrorHandler = XSetIOErrorHandler(x11IOErrorHandler); } } else { |