aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/stub_includes/jni/win32/jawt_md.h5
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java16
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;
}