aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
Diffstat (limited to 'make')
-rw-r--r--make/build-nativewindow.xml13
-rw-r--r--make/config/nativewindow/win32-CustomJavaCode.java56
-rw-r--r--make/config/nativewindow/win32-lib.cfg5
-rw-r--r--make/stub_includes/win32/windows.h1
-rw-r--r--make/stub_includes/win32/wingdi.h2
5 files changed, 58 insertions, 19 deletions
diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml
index 432646841..c7e04dbbb 100644
--- a/make/build-nativewindow.xml
+++ b/make/build-nativewindow.xml
@@ -560,14 +560,16 @@
</patternset>
<patternset id="c.src.files.x11">
- <include name="${rootrel.generated.c}/X11/X11*.c" if="isX11"/>
- <include name="${rootrel.src.c}/x11/Xmisc.c" if="isX11"/>
- <include name="${rootrel.src.c}/x11/XineramaHelper.c" if="isX11"/>
+ <include name="${rootrel.generated.c}/X11/X11*.c"/>
+ <include name="${rootrel.src.c}/x11/Xmisc.c"/>
+ <include name="${rootrel.src.c}/x11/XineramaHelper.c"/>
+ <include name="${rootrel.src.c}/NativewindowCommon.c"/>
</patternset>
<patternset id="c.src.files.windows">
- <include name="${rootrel.generated.c}/Windows/GDI*.c" if="isWindows"/>
- <include name="${rootrel.src.c}/windows/GDImisc.c" if="isWindows"/>
+ <include name="${rootrel.generated.c}/Windows/GDI*.c"/>
+ <include name="${rootrel.src.c}/windows/GDImisc.c"/>
+ <include name="${rootrel.src.c}/NativewindowCommon.c"/>
</patternset>
<echo message="Compiling @{output.lib.name}" />
@@ -591,6 +593,7 @@
<includepath path="${src.generated.c}/X11" if="isX11"/>
<includepath path="${src.generated.c}/MacOSX" if="isOSX"/>
<includepath path="${src.generated.c}/Windows" if="isWindows"/>
+ <includepath path="${src.c}"/>
<!-- This must come last to not override real include paths -->
<!-- includepath path="stub_includes/macosx" if="isOSX" / -->
diff --git a/make/config/nativewindow/win32-CustomJavaCode.java b/make/config/nativewindow/win32-CustomJavaCode.java
index 0c1a3a402..5d0c82998 100644
--- a/make/config/nativewindow/win32-CustomJavaCode.java
+++ b/make/config/nativewindow/win32-CustomJavaCode.java
@@ -1,22 +1,50 @@
- static {
- NWJNILibLoader.loadNativeWindow("win32");
-
- if( !initIDs0() ) {
- throw new NativeWindowException("GDI: Could not initialized native stub");
- }
- }
+ private static final boolean DEBUG = Debug.debug("GDI");
+
+ private static final String dummyWindowClassNameBase = "_dummyWindow_clazz" ;
+ private static RegisteredClassFactory dummyWindowClassFactory;
+ private static boolean isInit = false;
- public static synchronized void initSingleton() {
- }
private static native boolean initIDs0();
+ private static native long getDummyWndProc0();
- private static Object createDummyWindowSync = new Object();
+ 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;
+ }
+ }
+
+ private static RegisteredClass dummyWindowClass = null;
+ private static Object dummyWindowSync = new Object();
public static long CreateDummyWindow(int x, int y, int width, int height) {
- synchronized(createDummyWindowSync) {
- return CreateDummyWindow0(x, y, width, height);
+ synchronized(dummyWindowSync) {
+ dummyWindowClass = dummyWindowClassFactory.getSharedClass();
+ return CreateDummyWindow0(dummyWindowClass.getHandle(), dummyWindowClass.getName(), dummyWindowClass.getName(), 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) {
@@ -24,3 +52,7 @@
}
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 e140ed3aa..0ba7d63bc 100644
--- a/make/config/nativewindow/win32-lib.cfg
+++ b/make/config/nativewindow/win32-lib.cfg
@@ -22,7 +22,10 @@ Opaque long void **
Import javax.media.nativewindow.util.Point
Import javax.media.nativewindow.NativeWindowException
+Import javax.media.nativewindow.windows.RegisteredClass
+Import javax.media.nativewindow.windows.RegisteredClassFactory
Import com.jogamp.nativewindow.impl.NWJNILibLoader
+import com.jogamp.nativewindow.impl.Debug
CustomCCode #define WIN32_LEAN_AND_MEAN
CustomCCode #include <windows.h>
@@ -33,7 +36,7 @@ CustomCCode #include <stddef.h>
Include ../intptr.cfg
-CustomCCode extern HWND CreateDummyWindow0( int x, int y, int width, int height ) ;
+CustomCCode extern HINSTANCE GetApplicationHandle();
IncludeAs CustomJavaCode GDI win32-CustomJavaCode.java
diff --git a/make/stub_includes/win32/windows.h b/make/stub_includes/win32/windows.h
index d9f9e692a..382ab8c81 100644
--- a/make/stub_includes/win32/windows.h
+++ b/make/stub_includes/win32/windows.h
@@ -34,6 +34,7 @@ typedef unsigned int* PUINT;
typedef unsigned int UINT;
typedef unsigned short USHORT;
typedef unsigned short WORD;
+typedef unsigned short ATOM;
/* Necessary handle typedefs for parsing wglext.h */
diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h
index 73f6276fd..7862b5533 100644
--- a/make/stub_includes/win32/wingdi.h
+++ b/make/stub_includes/win32/wingdi.h
@@ -187,7 +187,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
- HWND CreateDummyWindow0( int x, int y, int width, int height ) ;
+ HINSTANCE GetApplicationHandle();
WINUSERAPI BOOL WINAPI ShowWindow(HWND hWnd, int nCmdShow);
WINUSERAPI HDC WINAPI GetDC(HWND);
WINUSERAPI int WINAPI ReleaseDC(HWND hWnd, HDC hDC);