diff options
Diffstat (limited to 'make/config/nativewindow')
-rwxr-xr-x | make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java | 6 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-macosx.cfg | 6 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-win32.cfg | 6 | ||||
-rw-r--r-- | make/config/nativewindow/jawt-x11.cfg | 6 | ||||
-rwxr-xr-x | make/config/nativewindow/x11-CustomCCode.c | 169 | ||||
-rw-r--r-- | make/config/nativewindow/x11-CustomJavaCode.java | 16 | ||||
-rw-r--r-- | make/config/nativewindow/x11-lib.cfg | 21 |
7 files changed, 37 insertions, 193 deletions
diff --git a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java index dab377ad4..aad0ab261 100755 --- a/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java +++ b/make/config/nativewindow/jawt-DrawingSurfaceInfo-CustomJavaCode.java @@ -16,12 +16,12 @@ private static JAWT_PlatformInfo newPlatformInfo(ByteBuffer buf) { try { Class factoryClass; if (osName.startsWith("wind")) { - factoryClass = Class.forName("com.sun.nativewindow.impl.jawt.windows.JAWT_Win32DrawingSurfaceInfo"); + factoryClass = Class.forName("com.jogamp.nativewindow.impl.jawt.windows.JAWT_Win32DrawingSurfaceInfo"); } else if (osName.startsWith("mac os x")) { - factoryClass = Class.forName("com.sun.nativewindow.impl.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo"); + factoryClass = Class.forName("com.jogamp.nativewindow.impl.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo"); } else { // Assume Linux, Solaris, etc. Should probably test for these explicitly. - factoryClass = Class.forName("com.sun.nativewindow.impl.jawt.x11.JAWT_X11DrawingSurfaceInfo"); + factoryClass = Class.forName("com.jogamp.nativewindow.impl.jawt.x11.JAWT_X11DrawingSurfaceInfo"); } platformInfoFactoryMethod = factoryClass.getMethod("create", new Class[] { ByteBuffer.class }); diff --git a/make/config/nativewindow/jawt-macosx.cfg b/make/config/nativewindow/jawt-macosx.cfg index b047ecdff..dea1a27b7 100644 --- a/make/config/nativewindow/jawt-macosx.cfg +++ b/make/config/nativewindow/jawt-macosx.cfg @@ -1,7 +1,7 @@ # This .cfg file is used to generate the interface to the JAWT, which # is used by the MacOSXOnscreenGLContext. Style AllStatic -Package com.sun.nativewindow.impl.jawt +Package com.jogamp.nativewindow.impl.jawt JavaClass JAWTFactory JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/MacOSX @@ -22,8 +22,8 @@ CustomCCode #include <jawt.h> CustomCCode #include </usr/include/machine/types.h> import java.security.* -import com.sun.nativewindow.impl.jawt.* -StructPackage JAWT_MacOSXDrawingSurfaceInfo com.sun.nativewindow.impl.jawt.macosx +import com.jogamp.nativewindow.impl.jawt.* +StructPackage JAWT_MacOSXDrawingSurfaceInfo com.jogamp.nativewindow.impl.jawt.macosx EmitStruct JAWT_MacOSXDrawingSurfaceInfo Implements JAWT_MacOSXDrawingSurfaceInfo JAWT_PlatformInfo diff --git a/make/config/nativewindow/jawt-win32.cfg b/make/config/nativewindow/jawt-win32.cfg index e7754843e..af0c7ce29 100644 --- a/make/config/nativewindow/jawt-win32.cfg +++ b/make/config/nativewindow/jawt-win32.cfg @@ -1,7 +1,7 @@ # This .cfg file is used to generate the interface to the JAWT, which # is used by the WindowsOnscreenGLContext. Style AllStatic -Package com.sun.nativewindow.impl.jawt +Package com.jogamp.nativewindow.impl.jawt JavaClass JAWTFactory JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/Windows @@ -22,8 +22,8 @@ CustomCCode #include <jawt.h> Include ../intptr.cfg import java.security.* -import com.sun.nativewindow.impl.jawt.* -StructPackage JAWT_Win32DrawingSurfaceInfo com.sun.nativewindow.impl.jawt.windows +import com.jogamp.nativewindow.impl.jawt.* +StructPackage JAWT_Win32DrawingSurfaceInfo com.jogamp.nativewindow.impl.jawt.windows EmitStruct JAWT_Win32DrawingSurfaceInfo Implements JAWT_Win32DrawingSurfaceInfo JAWT_PlatformInfo diff --git a/make/config/nativewindow/jawt-x11.cfg b/make/config/nativewindow/jawt-x11.cfg index 25df57a1f..ccfe009dd 100644 --- a/make/config/nativewindow/jawt-x11.cfg +++ b/make/config/nativewindow/jawt-x11.cfg @@ -1,7 +1,7 @@ # This .cfg file is used to generate the interface to the JAWT, which # is used by the X11OnscreenGLContext. Style AllStatic -Package com.sun.nativewindow.impl.jawt +Package com.jogamp.nativewindow.impl.jawt JavaClass JAWTFactory JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/X11 @@ -22,8 +22,8 @@ CustomCCode #include <inttypes.h> CustomCCode #include <jawt.h> import java.security.* -import com.sun.nativewindow.impl.jawt.* -StructPackage JAWT_X11DrawingSurfaceInfo com.sun.nativewindow.impl.jawt.x11 +import com.jogamp.nativewindow.impl.jawt.* +StructPackage JAWT_X11DrawingSurfaceInfo com.jogamp.nativewindow.impl.jawt.x11 EmitStruct JAWT_X11DrawingSurfaceInfo Implements JAWT_X11DrawingSurfaceInfo JAWT_PlatformInfo diff --git a/make/config/nativewindow/x11-CustomCCode.c b/make/config/nativewindow/x11-CustomCCode.c deleted file mode 100755 index c1f66fee1..000000000 --- a/make/config/nativewindow/x11-CustomCCode.c +++ /dev/null @@ -1,169 +0,0 @@ -#include <inttypes.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -/* Linux headers don't work properly */ -#define __USE_GNU -#include <dlfcn.h> -#undef __USE_GNU - -/* Current versions of Solaris don't expose the XF86 extensions, - although with the recent transition to Xorg this will probably - happen in an upcoming release */ -#if !defined(__sun) && !defined(_HPUX) -#include <X11/extensions/xf86vmode.h> -#else -/* Need to provide stubs for these */ -Bool XF86VidModeGetGammaRampSize( - Display *display, - int screen, - int* size) -{ - return False; -} - -Bool XF86VidModeGetGammaRamp( - Display *display, - int screen, - int size, - unsigned short *red_array, - unsigned short *green_array, - unsigned short *blue_array) { - return False; -} -Bool XF86VidModeSetGammaRamp( - Display *display, - int screen, - int size, - unsigned short *red_array, - unsigned short *green_array, - unsigned short *blue_array) { - return False; -} -#endif - -/* HP-UX doesn't define RTLD_DEFAULT. */ -#if defined(_HPUX) && !defined(RTLD_DEFAULT) -#define RTLD_DEFAULT NULL -#endif - -/* Need to expose DefaultScreen and RootWindow macros to Java */ -JNIEXPORT jlong JNICALL -Java_com_sun_nativewindow_impl_x11_X11Lib_DefaultScreen(JNIEnv *env, jclass _unused, jlong display) { - return DefaultScreen((Display*) (intptr_t) display); -} - -JNIEXPORT jlong JNICALL -Java_com_sun_nativewindow_impl_x11_X11Lib_DefaultVisualID(JNIEnv *env, jclass _unused, jlong display, jint screen) { - return (jlong) XVisualIDFromVisual( DefaultVisual( (Display*) (intptr_t) display, screen ) ); -} - -JNIEXPORT jlong JNICALL -Java_com_sun_nativewindow_impl_x11_X11Lib_RootWindow(JNIEnv *env, jclass _unused, jlong display, jint screen) { - return RootWindow((Display*) (intptr_t) display, screen); -} - -JNIEXPORT jlong JNICALL -Java_com_sun_nativewindow_impl_x11_X11Lib_dlopen(JNIEnv *env, jclass _unused, jstring name) { - const jbyte* chars; - void* res; - chars = (*env)->GetStringUTFChars(env, name, NULL); - res = dlopen(chars, RTLD_LAZY | RTLD_GLOBAL); - (*env)->ReleaseStringUTFChars(env, name, chars); - return (jlong) ((intptr_t) res); -} - -JNIEXPORT jlong JNICALL -Java_com_sun_nativewindow_impl_x11_X11Lib_dlsym(JNIEnv *env, jclass _unused, jstring name) { - const jbyte* chars; - void* res; - chars = (*env)->GetStringUTFChars(env, name, NULL); - res = dlsym(RTLD_DEFAULT, chars); - (*env)->ReleaseStringUTFChars(env, name, chars); - return (jlong) ((intptr_t) res); -} - -/* Need to pull this in as we don't have a stub header for it */ -extern Bool XineramaEnabled(Display* display); - -static const char * clazzNameInternalBufferUtil = "com/sun/nativewindow/impl/InternalBufferUtil"; -static const char * clazzNameInternalBufferUtilStaticCstrName = "copyByteBuffer"; -static const char * clazzNameInternalBufferUtilStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;"; -static const char * clazzNameByteBuffer = "java/nio/ByteBuffer"; -static jclass clazzInternalBufferUtil = NULL; -static jmethodID cstrInternalBufferUtil = NULL; -static jclass clazzByteBuffer = NULL; - -static void _initClazzAccess(JNIEnv *env) { - jclass c; - - if(NULL!=cstrInternalBufferUtil) return ; - - c = (*env)->FindClass(env, clazzNameInternalBufferUtil); - if(NULL==c) { - fprintf(stderr, "FatalError: Java_com_sun_nativewindow_impl_x11_X11Lib: can't find %s\n", clazzNameInternalBufferUtil); - (*env)->FatalError(env, clazzNameInternalBufferUtil); - } - clazzInternalBufferUtil = (jclass)(*env)->NewGlobalRef(env, c); - if(NULL==clazzInternalBufferUtil) { - fprintf(stderr, "FatalError: Java_com_sun_nativewindow_impl_x11_X11Lib: can't use %s\n", clazzNameInternalBufferUtil); - (*env)->FatalError(env, clazzNameInternalBufferUtil); - } - c = (*env)->FindClass(env, clazzNameByteBuffer); - if(NULL==c) { - fprintf(stderr, "FatalError: Java_com_sun_nativewindow_impl_x11_X11Lib: can't find %s\n", clazzNameByteBuffer); - (*env)->FatalError(env, clazzNameByteBuffer); - } - clazzByteBuffer = (jclass)(*env)->NewGlobalRef(env, c); - if(NULL==c) { - fprintf(stderr, "FatalError: Java_com_sun_nativewindow_impl_x11_X11Lib: can't use %s\n", clazzNameByteBuffer); - (*env)->FatalError(env, clazzNameByteBuffer); - } - - cstrInternalBufferUtil = (*env)->GetStaticMethodID(env, clazzInternalBufferUtil, - clazzNameInternalBufferUtilStaticCstrName, clazzNameInternalBufferUtilStaticCstrSignature); - if(NULL==cstrInternalBufferUtil) { - fprintf(stderr, "FatalError: Java_com_sun_nativewindow_impl_x11_X11Lib:: can't create %s.%s %s\n", - clazzNameInternalBufferUtil, - clazzNameInternalBufferUtilStaticCstrName, clazzNameInternalBufferUtilStaticCstrSignature); - (*env)->FatalError(env, clazzNameInternalBufferUtilStaticCstrName); - } -} - -/* Java->C glue code: - * Java package: com.sun.nativewindow.impl.x11.X11Lib - * Java method: XVisualInfo XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, java.nio.IntBuffer arg3) - * C function: XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); - */ -JNIEXPORT jobject JNICALL -Java_com_sun_nativewindow_impl_x11_X11Lib_XGetVisualInfoCopied1__JJLjava_nio_ByteBuffer_2Ljava_lang_Object_2I(JNIEnv *env, jclass _unused, jlong arg0, jlong arg1, jobject arg2, jobject arg3, jint arg3_byte_offset) { - XVisualInfo * _ptr2 = NULL; - int * _ptr3 = NULL; - XVisualInfo * _res; - int count; - jobject jbyteSource; - jobject jbyteCopy; - if (arg2 != NULL) { - _ptr2 = (XVisualInfo *) (((char*) (*env)->GetDirectBufferAddress(env, arg2)) + 0); - } - if (arg3 != NULL) { - _ptr3 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) + arg3_byte_offset); - } - _res = XGetVisualInfo((Display *) (intptr_t) arg0, (long) arg1, (XVisualInfo *) _ptr2, (int *) _ptr3); - count = _ptr3[0]; - if (arg3 != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, arg3, _ptr3, 0); - } - if (_res == NULL) return NULL; - - _initClazzAccess(env); - - jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(XVisualInfo)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, - clazzInternalBufferUtil, cstrInternalBufferUtil, jbyteSource); - - // FIXME: remove reference/gc jbyteSource ?? - XFree(_res); - - return jbyteCopy; -} - diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java index b1ee3a6c3..44bb1e8d0 100644 --- a/make/config/nativewindow/x11-CustomJavaCode.java +++ b/make/config/nativewindow/x11-CustomJavaCode.java @@ -5,10 +5,10 @@ if(arg3 != null && arg3.length <= arg3_offset) throw new RuntimeException("array offset argument \"arg3_offset\" (" + arg3_offset + ") equals or exceeds array length (" + arg3.length + ")"); java.nio.ByteBuffer _res; - _res = XGetVisualInfoCopied1(arg0, arg1, ((arg2 == null) ? null : arg2.getBuffer()), arg3, BufferFactory.SIZEOF_INT * arg3_offset); + _res = XGetVisualInfoCopied1(arg0, arg1, ((arg2 == null) ? null : arg2.getBuffer()), arg3, Buffers.SIZEOF_INT * arg3_offset); if (_res == null) return null; - BufferFactory.nativeOrder(_res); + Buffers.nativeOrder(_res); XVisualInfo[] _retarray = new XVisualInfo[getFirstElement(arg3, arg3_offset)]; for (int _count = 0; _count < getFirstElement(arg3, arg3_offset); _count++) { _res.position(_count * XVisualInfo.size()); @@ -24,3 +24,15 @@ /** 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 DefaultVisualID(long display, int screen); + + public static native long CreateDummyWindow(long display, int screen_index, long visualID); + public static native void DestroyDummyWindow(long display, long window); + + public static native long dlopen(String name); + public static native long dlsym(String name); + + public static native int XCloseDisplay(long display); + public static native void XUnlockDisplay(long display); + public static native void XLockDisplay(long display); + diff --git a/make/config/nativewindow/x11-lib.cfg b/make/config/nativewindow/x11-lib.cfg index 321444725..cf9642398 100644 --- a/make/config/nativewindow/x11-lib.cfg +++ b/make/config/nativewindow/x11-lib.cfg @@ -1,6 +1,6 @@ # This .cfg file is used to generate the interface to the GLX routines # used internally by the X11GLContext implementation. -Package com.sun.nativewindow.impl.x11 +Package com.jogamp.nativewindow.impl.x11 JavaClass X11Lib Style allstatic @@ -20,24 +20,25 @@ 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); - IncludeAs CustomJavaCode X11Lib x11-CustomJavaCode.java -IncludeAs CustomCCode x11-CustomCCode.c +# Now resides in x11/Xmisc.c: IncludeAs CustomCCode x11-CustomCCode.c ArgumentIsString XOpenDisplay 0 -# Need to expose DefaultScreen and RootWindow macros to Java -CustomJavaCode X11Lib public static native int DefaultScreen(long display); -CustomJavaCode X11Lib public static native long DefaultVisualID(long display, int screen); -CustomJavaCode X11Lib public static native long RootWindow(long display, int screen); - # We have Custom code for the following Ignore XGetVisualInfo +ManuallyImplement XCloseDisplay +ManuallyImplement XUnlockDisplay +ManuallyImplement XLockDisplay + # Helper routine to make the ReturnedArrayLength expression below work correctly CustomJavaCode X11Lib private static int getFirstElement(IntBuffer buf) { return buf.get(buf.position()); } CustomJavaCode X11Lib private static int getFirstElement(int[] arr, int offset) { return arr[offset]; } CustomJavaCode XVisualInfo public static XVisualInfo create(XVisualInfo s) { XVisualInfo d = XVisualInfo.create(); d.getBuffer().put(s.getBuffer()); d.getBuffer().rewind(); s.getBuffer().rewind(); return d; } + +CustomCCode #include <inttypes.h> +CustomCCode #include <X11/Xlib.h> +CustomCCode #include <X11/Xutil.h> + |