From d1ac91ae3e8fab5176cb677a20fd764f04a00cc8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Nov 2011 01:21:50 +0100 Subject: Fix regression JAWTWindow/AWTGraphicsConfiguration updateGraphicsConfiguration() of commit 46542168d64b37f544f61802693f15b59b224e4e While introducing NewtCanvasAWT's lifetime reference of (JAWTWindow) nativeWindow using updateGraphicsConfiguration() to determine the actual config values at addNotify(), it was overseen that the AWTGraphicsDevice needs to be re-validated. JAWTWindow's validateNative() ensures that the AWTGraphicsDevice reflects the platform native handle where required (X11). --- .../classes/jogamp/nativewindow/jawt/JAWTWindow.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nativewindow/classes/jogamp') diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java index c8ce13b40..41f79c98f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java @@ -102,6 +102,16 @@ public abstract class JAWTWindow implements NativeWindow { } validateNative(); } + + /** + * Implementors shall ensure that all native handles are valid, eg. the {@link javax.media.nativewindow.awt.AWTGraphicsDevice AWTGraphicsDevice}'s + * subtype via {@link javax.media.nativewindow.awt.AWTGraphicsDevice#setSubType(String, long) awtGraphicsDevice.setSubType(NativeWindowFactory.TYPE_X11, displayHandle)}. + *

+ * This method may be called several times, + * hence the implementation shall check for valid values 1st and bail out early if satisfied. + *

+ * @throws NativeWindowException + */ protected abstract void validateNative() throws NativeWindowException; protected synchronized void invalidate() { @@ -164,6 +174,7 @@ public abstract class JAWTWindow implements NativeWindow { protected abstract int lockSurfaceImpl() throws NativeWindowException; public final int lockSurface() throws NativeWindowException { + validateNative(); surfaceLock.lock(); int res = surfaceLock.getHoldCount() == 1 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS; // new lock ? -- cgit v1.2.3