diff options
Diffstat (limited to 'make/config')
-rw-r--r-- | make/config/jogl/cg-common-CustomJavaCode.java | 6 | ||||
-rw-r--r-- | make/config/jogl/glx-CustomJavaCode.java | 2 | ||||
-rw-r--r-- | make/config/nativewindow/win32-CustomJavaCode.java | 58 | ||||
-rw-r--r-- | make/config/nativewindow/win32-lib.cfg | 3 |
4 files changed, 50 insertions, 19 deletions
diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java index cdaa6f2b2..31d1961fc 100644 --- a/make/config/jogl/cg-common-CustomJavaCode.java +++ b/make/config/jogl/cg-common-CustomJavaCode.java @@ -1,12 +1,12 @@ -private static DynamicLookupHelper cgDynamicLookupHelper; -private static CgProcAddressTable cgProcAddressTable; +private static final DynamicLibraryBundle cgDynamicLookupHelper; +private static final CgProcAddressTable cgProcAddressTable; static { cgProcAddressTable = new CgProcAddressTable(); if(null==cgProcAddressTable) { throw new RuntimeException("Couldn't instantiate CgProcAddressTable"); } - DynamicLibraryBundle cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo()); + cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo()); if(null==cgDynamicLookupHelper) { throw new RuntimeException("Null CgDynamicLookupHelper"); } diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java index 0c3693b8b..36ad10031 100644 --- a/make/config/jogl/glx-CustomJavaCode.java +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -21,7 +21,7 @@ { final long __addr_ = glxProcAddressTable._addressof_glXChooseFBConfig; if (__addr_ == 0) { - throw new GLException("Method \"glXGetVisualFromFBConfig\" not available"); + throw new GLException("Method \"glXChooseFBConfig\" not available"); } if(attribList != null && attribList.length <= attribList_offset) throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); diff --git a/make/config/nativewindow/win32-CustomJavaCode.java b/make/config/nativewindow/win32-CustomJavaCode.java index 54a7fa53a..5d0c82998 100644 --- a/make/config/nativewindow/win32-CustomJavaCode.java +++ b/make/config/nativewindow/win32-CustomJavaCode.java @@ -1,28 +1,58 @@ - private static final long hInstance; + private static final boolean DEBUG = Debug.debug("GDI"); - static { - NWJNILibLoader.loadNativeWindow("win32"); - hInstance = initIDs0(); - if( 0 == hInstance ) { - throw new NativeWindowException("GDI: Could not initialized native stub"); + private static final String dummyWindowClassNameBase = "_dummyWindow_clazz" ; + private static RegisteredClassFactory dummyWindowClassFactory; + private static boolean isInit = false; + + private static native boolean initIDs0(); + private static native long getDummyWndProc0(); + + public static synchronized void initSingleton(boolean firstX11ActionOnProcess) { + if(!isInit) { + NWJNILibLoader.loadNativeWindow("win32"); + + if( !initIDs0() ) { + throw new NativeWindowException("GDI: Could not initialized native stub"); + } + + if(DEBUG) { + System.out.println("GDI.isFirstX11ActionOnProcess: "+firstX11ActionOnProcess); + } + + dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0()); + isInit = true; } } - public static synchronized void initSingleton() { - } - private static native long initIDs0(); + private static RegisteredClass dummyWindowClass = null; + private static Object dummyWindowSync = new Object(); - public static long getModuleHandle() { - return hInstance; + public static long CreateDummyWindow(int x, int y, int width, int height) { + synchronized(dummyWindowSync) { + dummyWindowClass = dummyWindowClassFactory.getSharedClass(); + return CreateDummyWindow0(dummyWindowClass.getHandle(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height); + } } - public static long CreateDummyWindow(int x, int y, int width, int height) { - return CreateDummyWindow0(getModuleHandle(), x, y, width, height); + public static boolean DestroyDummyWindow(long hwnd) { + boolean res; + synchronized(dummyWindowSync) { + if( null == dummyWindowClass ) { + throw new InternalError("GDI Error ("+dummyWindowClassFactory.getSharedRefCount()+"): SharedClass is null"); + } + res = DestroyWindow(hwnd); + dummyWindowClassFactory.releaseSharedClass(); + } + return res; } public static Point GetRelativeLocation(long src_win, long dest_win, int src_x, int src_y) { - return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y); + return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y); } private static native Object GetRelativeLocation0(long src_win, long dest_win, int src_x, int src_y); + public static native boolean CreateWindowClass(long hInstance, String clazzName, long wndProc); + public static native boolean DestroyWindowClass(long hInstance, String className); + static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height); + diff --git a/make/config/nativewindow/win32-lib.cfg b/make/config/nativewindow/win32-lib.cfg index 46c4f2f92..d4ca642bf 100644 --- a/make/config/nativewindow/win32-lib.cfg +++ b/make/config/nativewindow/win32-lib.cfg @@ -23,6 +23,7 @@ Opaque long void ** Import javax.media.nativewindow.util.Point Import javax.media.nativewindow.NativeWindowException Import com.jogamp.nativewindow.impl.NWJNILibLoader +import com.jogamp.nativewindow.impl.Debug CustomCCode #define WIN32_LEAN_AND_MEAN CustomCCode #include <windows.h> @@ -33,7 +34,7 @@ CustomCCode #include <stddef.h> Include ../intptr.cfg -CustomCCode extern HWND CreateDummyWindow0( HINSTANCE hInstance, int x, int y, int width, int height ) ; +CustomCCode extern HINSTANCE GetApplicationHandle(); IncludeAs CustomJavaCode GDI win32-CustomJavaCode.java |