diff options
author | Sven Gothel <[email protected]> | 2010-05-05 15:17:06 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-05-05 15:17:06 +0200 |
commit | 6700db86ea0c14d8eee5b8a81ddd6e96b0832ea6 (patch) | |
tree | aae74a559bc63527fccca1fdbc8fda6dca4e341e | |
parent | 574a772703531da2854a566662af9c8b8f9770fe (diff) |
JAWT Windows Fix: Use the JAWT window handle entry [to return it]
-rwxr-xr-x | make/stub_includes/jni/win32/jawt_md.h | 5 | ||||
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/make/stub_includes/jni/win32/jawt_md.h b/make/stub_includes/jni/win32/jawt_md.h index ebfc66afe..2e1fa52f5 100755 --- a/make/stub_includes/jni/win32/jawt_md.h +++ b/make/stub_includes/jni/win32/jawt_md.h @@ -21,11 +21,14 @@ extern "C" { */ typedef struct jawt_Win32DrawingSurfaceInfo { /* Native window, DDB, or DIB handle */ + /** union { HWND hwnd; HBITMAP hbitmap; void* pbits; - }; + }; */ + HWND handle; + /* * This HDC should always be used instead of the HDC returned from * BeginPaint() or any calls to GetDC(). diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java index b23ad3f50..7d680dfa0 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java @@ -56,6 +56,11 @@ public class WindowsJAWTWindow extends JAWTWindow { protected void initNative() throws NativeWindowException { } + public synchronized void invalidate() { + super.invalidate(); + windowHandle = 0; + } + public int lockSurface() throws NativeWindowException { int ret = super.lockSurface(); if(LOCK_SUCCESS != ret) { @@ -105,8 +110,9 @@ public class WindowsJAWTWindow extends JAWTWindow { super.unlockSurface(); return LOCK_SURFACE_NOT_READY; } + windowHandle = win32dsi.getHandle(); drawable = win32dsi.getHdc(); - if (drawable == 0) { + if (windowHandle == 0 || drawable == 0) { // Widget not yet realized ds.FreeDrawingSurfaceInfo(dsi); ds.Unlock(); @@ -157,6 +163,10 @@ public class WindowsJAWTWindow extends JAWTWindow { } } + public long getWindowHandle() { + return windowHandle; + } + // Variables for lockSurface/unlockSurface private JAWT_DrawingSurface ds; private JAWT_DrawingSurfaceInfo dsi; @@ -165,6 +175,8 @@ public class WindowsJAWTWindow extends JAWTWindow { private int profilingLockSurfaceTicks = 0; private long profilingUnlockSurfaceTime = 0; private int profilingUnlockSurfaceTicks = 0; - + + // lifetime: valid after lock, forever until invalidate + protected long windowHandle; } |