diff options
author | Sven Gothel <[email protected]> | 2012-03-04 23:09:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-04 23:09:11 +0100 |
commit | 006e9fe402a0a47b45fd2c4af51296aef895e8b5 (patch) | |
tree | e9991f7cda1edad6e6693567932c4796fbd102c8 /src/newt | |
parent | b2c309aab9be8c02d454c8e36cc3976f9c4b3584 (diff) |
NEWT/Windows lockSurfaceImpl(): Detect hdc change and result w/ LOCK_SURFACE_CHANGED
This allows an underlying delegation/mapping to update the handles, eg.: EGLDrawable.
See commit a0177c8a1048683e5d43f4712f8f9e37091d4e85
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java b/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java index d14c47f5a..588e26eb7 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java @@ -53,6 +53,7 @@ public class WindowsWindow extends WindowImpl { private long hmon; private long hdc; + private long hdc_old; private long windowHandleClose; static { @@ -69,7 +70,19 @@ public class WindowsWindow extends WindowImpl { } hdc = GDI.GetDC(getWindowHandle()); hmon = MonitorFromWindow0(getWindowHandle()); - return ( 0 != hdc ) ? LOCK_SUCCESS : LOCK_SURFACE_NOT_READY; + + // return ( 0 == hdc ) ? LOCK_SURFACE_NOT_READY : ( hdc_old != hdc ) ? LOCK_SURFACE_CHANGED : LOCK_SUCCESS ; + if( 0 == hdc ) { + return LOCK_SURFACE_NOT_READY; + } + if( hdc_old == hdc ) { + return LOCK_SUCCESS; + } + if(DEBUG_IMPLEMENTATION) { + System.err.println("********** HDC change "+toHexString(hdc_old)+" -> "+toHexString(hdc)); + // Thread.dumpStack(); + } + return LOCK_SURFACE_CHANGED; } @Override @@ -78,6 +91,7 @@ public class WindowsWindow extends WindowImpl { throw new InternalError("surface not acquired"); } GDI.ReleaseDC(getWindowHandle(), hdc); + hdc_old = hdc; hdc=0; } @@ -92,9 +106,9 @@ public class WindowsWindow extends WindowImpl { long _hmon = MonitorFromWindow0(getWindowHandle()); if (hmon != _hmon) { if(DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Info: Window Device Changed "+Thread.currentThread().getName()+ - ", HMON "+toHexString(hmon)+" -> "+toHexString(_hmon)); - e.printStackTrace(); + System.err.println("Info: Window Device Changed "+Thread.currentThread().getName()+ + ", HMON "+toHexString(hmon)+" -> "+toHexString(_hmon)); + // Thread.dumpStack(); } hmon = _hmon; return true; @@ -149,6 +163,7 @@ public class WindowsWindow extends WindowImpl { } } hdc = 0; + hdc_old = 0; } if(windowHandleClose != 0) { try { |