diff options
Diffstat (limited to 'src/newt')
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/NewtFactory.java | 2 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/Window.java | 5 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/NEWTJNILibLoader.java (renamed from src/newt/classes/com/jogamp/newt/impl/NativeLibLoader.java) | 4 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/intel/gdl/Display.java | 2 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java | 2 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java | 2 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java | 2 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/util/MainThread.java | 6 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java | 2 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/x11/X11Display.java | 2 | ||||
-rwxr-xr-x | src/newt/native/X11Window.c | 34 |
11 files changed, 32 insertions, 31 deletions
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 2a696aa07..2d5c10c52 100755 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -36,7 +36,7 @@ package com.jogamp.newt; import javax.media.nativewindow.*; import java.util.ArrayList; import java.util.Iterator; -import com.jogamp.nativewindow.impl.jvm.JVMUtil; +import com.jogamp.common.jvm.JVMUtil; public abstract class NewtFactory { // Work-around for initialization order problems on Mac OS X diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 8f09ae364..5123ab19f 100755 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -36,8 +36,8 @@ package com.jogamp.newt; import com.jogamp.newt.impl.Debug; import com.jogamp.newt.util.EDTUtil; +import com.jogamp.common.util.*; import javax.media.nativewindow.*; -import com.jogamp.nativewindow.impl.NWReflection; import java.util.ArrayList; import java.util.Iterator; @@ -127,7 +127,7 @@ public abstract class Window implements NativeWindow if ( argsChecked < cstrArguments.length ) { throw new NativeWindowException("WindowClass "+windowClass+" constructor mismatch at argument #"+argsChecked+"; Constructor: "+getTypeStrList(cstrArgumentTypes)+", arguments: "+getArgsStrList(cstrArguments)); } - Window window = (Window) NWReflection.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ; + Window window = (Window) ReflectionUtil.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ; window.invalidate(); window.screen = screen; window.setUndecorated(undecorated); @@ -144,7 +144,6 @@ public abstract class Window implements NativeWindow } return window; } catch (Throwable t) { - t.printStackTrace(); throw new NativeWindowException(t); } } diff --git a/src/newt/classes/com/jogamp/newt/impl/NativeLibLoader.java b/src/newt/classes/com/jogamp/newt/impl/NEWTJNILibLoader.java index 52e4c0dc3..a4d234fd5 100644 --- a/src/newt/classes/com/jogamp/newt/impl/NativeLibLoader.java +++ b/src/newt/classes/com/jogamp/newt/impl/NEWTJNILibLoader.java @@ -46,9 +46,9 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashSet; -import com.jogamp.nativewindow.impl.NativeLibLoaderBase; +import com.jogamp.common.jvm.JNILibLoaderBase; -public class NativeLibLoader extends NativeLibLoaderBase { +public class NEWTJNILibLoader extends JNILibLoaderBase { public static void loadNEWT() { AccessController.doPrivileged(new PrivilegedAction() { diff --git a/src/newt/classes/com/jogamp/newt/intel/gdl/Display.java b/src/newt/classes/com/jogamp/newt/intel/gdl/Display.java index eb93943ee..a3e5501c4 100644 --- a/src/newt/classes/com/jogamp/newt/intel/gdl/Display.java +++ b/src/newt/classes/com/jogamp/newt/intel/gdl/Display.java @@ -40,7 +40,7 @@ public class Display extends com.jogamp.newt.Display { static int initCounter = 0; static { - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); if (!Screen.initIDs()) { throw new NativeWindowException("Failed to initialize GDL Screen jmethodIDs"); diff --git a/src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java b/src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java index 2f86125f8..0b5297685 100755 --- a/src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java +++ b/src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java @@ -41,7 +41,7 @@ import com.jogamp.newt.util.MainThread; public class MacDisplay extends Display { static { - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); if(!initNSApplication()) { throw new NativeWindowException("Failed to initialize native Application hook"); diff --git a/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java index a375181ac..999a407ec 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java +++ b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java @@ -41,7 +41,7 @@ import javax.media.nativewindow.egl.*; public class Display extends com.jogamp.newt.Display { static { - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); if (!Window.initIDs()) { throw new NativeWindowException("Failed to initialize BCEGL Window jmethodIDs"); diff --git a/src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java b/src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java index b09568237..6a28f992b 100755 --- a/src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java +++ b/src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java @@ -42,7 +42,7 @@ import javax.media.nativewindow.egl.*; public class KDDisplay extends Display { static { - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); if (!KDWindow.initIDs()) { throw new NativeWindowException("Failed to initialize KDWindow jmethodIDs"); diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 6cd4f8c69..daa09edce 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java @@ -43,10 +43,10 @@ import java.security.*; import javax.media.nativewindow.*; +import com.jogamp.common.util.*; import com.jogamp.newt.*; import com.jogamp.newt.impl.*; import com.jogamp.newt.macosx.MacDisplay; -import com.jogamp.nativewindow.impl.NWReflection; /** * NEWT Utility class MainThread<P> @@ -116,7 +116,7 @@ public class MainThread { // start user app .. try { - Class mainClass = NWReflection.getClass(mainClassName, true); + Class mainClass = ReflectionUtil.getClass(mainClassName, true); if(null==mainClass) { throw new RuntimeException(new ClassNotFoundException("MainThread couldn't find main class "+mainClassName)); } @@ -159,7 +159,7 @@ public class MainThread { System.arraycopy(args, 1, mainClassArgs, 0, args.length-1); } - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); shouldStop = false; tasks = new ArrayList(); diff --git a/src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java b/src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java index 05cab1a0a..281022901 100755 --- a/src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java +++ b/src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java @@ -45,7 +45,7 @@ public class WindowsDisplay extends Display { private static long hInstance; static { - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); if (!WindowsWindow.initIDs()) { throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs"); diff --git a/src/newt/classes/com/jogamp/newt/x11/X11Display.java b/src/newt/classes/com/jogamp/newt/x11/X11Display.java index 5fd6d9640..c8faefbf1 100755 --- a/src/newt/classes/com/jogamp/newt/x11/X11Display.java +++ b/src/newt/classes/com/jogamp/newt/x11/X11Display.java @@ -41,7 +41,7 @@ import com.jogamp.nativewindow.impl.x11.X11Util; public class X11Display extends Display { static { - NativeLibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWT(); if (!initIDs()) { throw new NativeWindowException("Failed to initialize X11Display jmethodIDs"); diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 33c5324e2..296172f6e 100755 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -159,11 +159,11 @@ static void _FatalError(JNIEnv *env, const char* msg, ...) va_end(ap); fprintf(stderr, buffer); + fprintf(stderr, "\n"); (*env)->FatalError(env, buffer); } -static const char * const ClazzNameRuntimeException = - "java/lang/RuntimeException"; +static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException"; static jclass runtimeExceptionClz=NULL; static const char * const ClazzNameNewtWindow = @@ -200,6 +200,7 @@ static void _throwNewRuntimeException(Display * unlockDisplay, JNIEnv *env, cons */ +static JNIEnv * x11ErrorHandlerJNIEnv = NULL; static XErrorHandler origErrorHandler = NULL ; static int displayDispatchErrorHandler(Display *dpy, XErrorEvent *e) @@ -213,15 +214,16 @@ static int displayDispatchErrorHandler(Display *dpy, XErrorEvent *e) { fprintf(stderr, " BadWindow (%p): Window probably already removed\n", e->resourceid); } else { - return origErrorHandler(dpy, e); + _throwNewRuntimeException(NULL, x11ErrorHandlerJNIEnv, "NEWT X11 Error: Display %p, Code 0x%X", dpy, e->error_code); } return 0; } -static void displayDispatchErrorHandlerEnable(int onoff) { +static void displayDispatchErrorHandlerEnable(int onoff, JNIEnv * env) { if(onoff) { if(NULL==origErrorHandler) { + x11ErrorHandlerJNIEnv = env; origErrorHandler = XSetErrorHandler(displayDispatchErrorHandler); } } else { @@ -329,13 +331,13 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_CompleteDisplay javaObjectAtom = (jlong) XInternAtom(dpy, "JOGL_JAVA_OBJECT", False); if(None==javaObjectAtom) { - _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!"); return; } windowDeleteAtom = (jlong) XInternAtom(dpy, "WM_DELETE_WINDOW", False); if(None==windowDeleteAtom) { - _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!"); return; } @@ -371,7 +373,7 @@ static void setJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, jlon { jobject test = (jobject) getPtrOut32Long(jogl_java_object_data); if( ! (jwindow==test) ) { - _throwNewRuntimeException(dpy, env, "Internal Error .. Encoded Window ref not the same %p != %p !\n", jwindow, test); + _throwNewRuntimeException(dpy, env, "Internal Error .. Encoded Window ref not the same %p != %p !", jwindow, test); return; } } @@ -415,7 +417,7 @@ static jobject getJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, j #ifdef VERBOSE_ON if(JNI_FALSE == (*env)->IsInstanceOf(env, jwindow, newtWindowClz)) { - _throwNewRuntimeException(dpy, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !\n", jwindow); + _throwNewRuntimeException(dpy, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !", jwindow); } #endif return jwindow; @@ -457,20 +459,20 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_DispatchMessages num_events--; if( 0==evt.xany.window ) { - _throwNewRuntimeException(dpy, env, "event window NULL, bail out!\n"); + _throwNewRuntimeException(dpy, env, "event window NULL, bail out!"); return ; } if(dpy!=evt.xany.display) { - _throwNewRuntimeException(dpy, env, "wrong display, bail out!\n"); + _throwNewRuntimeException(dpy, env, "wrong display, bail out!"); return ; } - displayDispatchErrorHandlerEnable(1); + displayDispatchErrorHandlerEnable(1, env); jwindow = getJavaWindowProperty(env, dpy, evt.xany.window, javaObjectAtom); - displayDispatchErrorHandlerEnable(0); + displayDispatchErrorHandlerEnable(0, env); if(NULL==jwindow) { fprintf(stderr, "Warning: NEWT X11 DisplayDispatch %p, Couldn't handle event %d for invalid X11 window %p\n", @@ -685,7 +687,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Window_CreateWindow } if(visualID<0) { - _throwNewRuntimeException(NULL, env, "invalid VisualID ..\n"); + _throwNewRuntimeException(NULL, env, "invalid VisualID .."); return 0; } @@ -712,7 +714,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Window_CreateWindow if (visual==NULL) { - _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!"); return 0; } @@ -797,11 +799,11 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_CloseWindow jwindow = getJavaWindowProperty(env, dpy, w, javaObjectAtom); if(NULL==jwindow) { - _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!"); return; } if ( JNI_FALSE == (*env)->IsSameObject(env, jwindow, obj) ) { - _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!\n"); + _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!"); return; } (*env)->DeleteGlobalRef(env, jwindow); |