diff options
Diffstat (limited to 'make')
-rw-r--r-- | make/build-common.xml | 8 | ||||
-rw-r--r-- | make/build-jogl.xml | 2 | ||||
-rw-r--r-- | make/build-junit.xml | 2 | ||||
-rwxr-xr-x | make/config/nativewindow/x11-CustomCCode.c | 61 | ||||
-rw-r--r-- | make/config/nativewindow/x11-CustomJavaCode.java | 5 | ||||
-rw-r--r-- | make/config/nativewindow/x11-lib.cfg | 5 | ||||
-rw-r--r-- | make/stub_includes/win32/wingdi.h | 2 |
7 files changed, 79 insertions, 6 deletions
diff --git a/make/build-common.xml b/make/build-common.xml index 10f37c3e4..d6c39c1ed 100644 --- a/make/build-common.xml +++ b/make/build-common.xml @@ -121,6 +121,8 @@ <property name="obj.gluegen" value="${build.gluegen}/obj"/> <property name="gluegen.jar" value="${build.gluegen}/gluegen.jar" /> <property name="junit.jar" value="${gluegen.make}/lib/junit-4.5.jar" /> + <property name="ant.jar" value="${ant.home}/lib/ant.jar" /> + <property name="ant-junit.jar" value="${ant.home}/lib/ant-junit.jar" /> <property name="nativewindow.make" value="." /> <property name="nativewindow.build.xml" value="${nativewindow.make}/build-nativewindow.xml" /> @@ -179,6 +181,8 @@ <path id="junit_jogl_newt.compile.classpath"> <pathelement location="${junit.jar}" /> + <pathelement location="${ant.jar}" /> + <pathelement location="${ant-junit.jar}" /> <pathelement location="${gluegen-rt.jar}" /> <pathelement location="${nativewindow.all.jar}" /> <pathelement location="${jogl.all.jar}" /> @@ -187,6 +191,8 @@ <path id="junit_jogl_newt.run.classpath"> <pathelement location="${junit.jar}" /> + <pathelement location="${ant.jar}" /> + <pathelement location="${ant-junit.jar}" /> <pathelement location="${gluegen-rt.jar}" /> <pathelement location="${nativewindow.all.jar}" /> <pathelement location="${jogl.all.jar}" /> @@ -194,7 +200,7 @@ <pathelement location="${jogl.test.jar}" /> </path> <property name="junit_jogl_newt.run.jars" - value="${junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${nativewindow.all.jar}${path.separator}${jogl.all.jar}${path.separator}${newt.all.jar}${path.separator}${jogl.test.jar}"/> + value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${nativewindow.all.jar}${path.separator}${jogl.all.jar}${path.separator}${newt.all.jar}${path.separator}${jogl.test.jar}"/> <!-- JavaSE combinations . NO.AWT --> <property name="nativewindow.all-noawt.jar" value="${build.nativewindow}/nativewindow.all-noawt.jar" /> diff --git a/make/build-jogl.xml b/make/build-jogl.xml index b1f0a02eb..93cf7bf6f 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -396,7 +396,7 @@ <and> <isset property="java.generate.skip.es1"/> <isset property="java.generate.skip.es2"/> - <!--isset property="java.generate.skip.gl2"/--> + <isset property="java.generate.skip.gl2"/> <isset property="java.generate.skip.glu"/> </and> </condition> diff --git a/make/build-junit.xml b/make/build-junit.xml index 58e8e3b7f..887060084 100644 --- a/make/build-junit.xml +++ b/make/build-junit.xml @@ -113,7 +113,7 @@ relative="true" failonerror="false"> <env key="${system.env.library.path}" path="${obj.all.paths}"/> - <env key="CLASSPATH" value="${ant.home}/lib/ant.jar${path.separator}${ant.home}/lib/ant-junit.jar${path.separator}${junit_jogl_newt.run.jars}"/> + <env key="CLASSPATH" value="${junit_jogl_newt.run.jars}"/> <arg value="-Djava.library.path=${obj.all.paths}"/> <arg line="${jvmarg.newt}"/> <arg line="com.jogamp.newt.util.MainThread"/> diff --git a/make/config/nativewindow/x11-CustomCCode.c b/make/config/nativewindow/x11-CustomCCode.c index 8eded9aa2..982a39f7e 100755 --- a/make/config/nativewindow/x11-CustomCCode.c +++ b/make/config/nativewindow/x11-CustomCCode.c @@ -167,3 +167,64 @@ Java_com_jogamp_nativewindow_impl_x11_X11Lib_XGetVisualInfoCopied1__JJLjava_nio_ return jbyteCopy; } + +static XIOErrorHandler origIOErrorHandler = NULL; + +static int displayIOErrorHandler(Display *dpy) +{ + fprintf(stderr, "Fatal: Nativewindow X11 IOError: Display %p not available\n", dpy); + origIOErrorHandler(dpy); + return 0; +} + +static void displayIOErrorHandlerEnable(int onoff) { + if(onoff) { + if(NULL==origIOErrorHandler) { + origIOErrorHandler = XSetIOErrorHandler(displayIOErrorHandler); + } + } else { + XSetIOErrorHandler(origIOErrorHandler); + origIOErrorHandler = NULL; + } +} + +/* Java->C glue code: + * Java package: com.jogamp.nativewindow.impl.x11.X11Lib + * Java method: int XCloseDisplay(long display) + * C function: int XCloseDisplay(Display * display); + */ +JNIEXPORT jint JNICALL +Java_com_jogamp_nativewindow_impl_x11_X11Lib_XCloseDisplay__J(JNIEnv *env, jclass _unused, jlong display) { + int _res; + // fprintf(stderr, "X11Lib.XCloseDisplay: %p\n", (Display *) (intptr_t) display); + displayIOErrorHandlerEnable(1); + _res = XCloseDisplay((Display *) (intptr_t) display); + displayIOErrorHandlerEnable(0); + return _res; +} + +/* Java->C glue code: + * Java package: com.jogamp.nativewindow.impl.x11.X11Lib + * Java method: long XOpenDisplay(java.lang.String arg0) + * C function: Display * XOpenDisplay(const char * ); + */ +JNIEXPORT jlong JNICALL +Java_com_jogamp_nativewindow_impl_x11_X11Lib_XOpenDisplay__Ljava_lang_String_2(JNIEnv *env, jclass _unused, jstring arg0) { + const char* _strchars_arg0 = NULL; + Display * _res; + if ( NULL != arg0 ) { + _strchars_arg0 = (*env)->GetStringUTFChars(env, arg0, (jboolean*)NULL); + if ( NULL == _strchars_arg0 ) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"arg0\" in native dispatcher for \"XOpenDisplay\""); + return 0; + } + } + _res = XOpenDisplay((char *) _strchars_arg0); + // fprintf(stderr, "X11Lib.XOpenDisplay: %s -> %p\n", _strchars_arg0, _res); + if ( NULL != arg0 ) { + (*env)->ReleaseStringUTFChars(env, arg0, _strchars_arg0); + } + return (jlong) (intptr_t) _res; +} + diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java index 5c269c6c8..d631c92cb 100644 --- a/make/config/nativewindow/x11-CustomJavaCode.java +++ b/make/config/nativewindow/x11-CustomJavaCode.java @@ -24,3 +24,8 @@ /** Entry point to C language function: <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */ private static native java.nio.ByteBuffer XGetVisualInfoCopied1(long arg0, long arg1, java.nio.ByteBuffer arg2, Object arg3, int arg3_byte_offset); + public static native long XOpenDisplay(String arg0); + public static native int XCloseDisplay(long display); + public static native long dlopen(String name); + public static native long dlsym(String name); + diff --git a/make/config/nativewindow/x11-lib.cfg b/make/config/nativewindow/x11-lib.cfg index 7a64307da..394dd230a 100644 --- a/make/config/nativewindow/x11-lib.cfg +++ b/make/config/nativewindow/x11-lib.cfg @@ -20,8 +20,9 @@ Opaque long Display * Opaque boolean Bool Opaque long GLXFBConfig -CustomJavaCode X11Lib public static native long dlopen(String name); -CustomJavaCode X11Lib public static native long dlsym(String name); +# Manually implement XOpenDisplay, XCloseDisplay, catching XIOError +ManuallyImplement XCloseDisplay +ManuallyImplement XOpenDisplay IncludeAs CustomJavaCode X11Lib x11-CustomJavaCode.java IncludeAs CustomCCode x11-CustomCCode.c diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h index 46aeec2b6..fbf2ec5ec 100644 --- a/make/stub_includes/win32/wingdi.h +++ b/make/stub_includes/win32/wingdi.h @@ -212,7 +212,7 @@ WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC, HGDIOBJ); // Routines for creation of a dummy window, device context and OpenGL // context for the purposes of getting wglChoosePixelFormatARB and // associated routines -HDC CreateDummyWindow(int,int,int,int); +HWND CreateDummyWindow( int x, int y, int width, int height ) ; WINUSERAPI BOOL WINAPI ShowWindow(HWND hWnd, int nCmdShow); WINUSERAPI HDC WINAPI GetDC(HWND); WINUSERAPI int WINAPI ReleaseDC(HWND hWnd, HDC hDC); |