aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-02-20 21:51:40 +0100
committerSven Gothel <[email protected]>2013-02-20 21:51:40 +0100
commit14b278536e6f8de2ee6254796b89bd27d5419b72 (patch)
tree0f4ec76f215cbba178eb6732c1f2a9363df9d6d5 /src
parentcf3ecdb670c0dfecd1394d5b9d5d5588c1bf71f3 (diff)
OSX/Java7/CALayer + JAWT: Partially Fix AWT/NEWT CALayer 'out of sight' bug, where our CALayer is moved out of the visible area
- same erroneous behavior for GLCanvas and NewtCanvasAWT - sized-frame: Set framesize and validate() it - sized-component: Set component preferred size and call frame.pack() - added workaround 'OffscreenLayerSurface.layoutSurfaceLayer()' to fix CALayer size, which snaps for: - OK initial size before setVisible: sized-frame and sized-component - OK resize w/ sized-frame - OK manual frame resize - Invisible: w/ sized-component after setVisible() ++ - CALayer-Sublayer (GL) has additional retain/release when added/removed to be on safe side.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java1
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m24
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java15
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java15
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java12
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java30
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m57
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java3
15 files changed, 165 insertions, 29 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index c9069f9ce..dc4fe955c 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -702,6 +702,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
sendReshape = true; // async if display() doesn't get called below, but avoiding deadlock
+ if(null != jawtWindow && jawtWindow.isOffscreenLayerSurfaceEnabled() ) {
+ jawtWindow.layoutSurfaceLayer();
+ }
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 37aca0cd7..9e0174595 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -713,6 +713,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
+ backingLayerHost.layoutSurfaceLayer();
} else {
lastWidth = drawable.getWidth();
lastHeight = drawable.getHeight();
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
index 55c4ad053..b965accab 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
@@ -114,6 +114,7 @@ extern GLboolean glIsVertexArray (GLuint array);
- (void)dealloc
{
CGLContextObj cglCtx = [self CGLContextObj];
+
DBG_PRINT("MyNSOpenGLContext::dealloc.0 %p (refcnt %d) - CGL-Ctx %p\n", self, (int)[self retainCount], cglCtx);
[self clearDrawable];
if( NULL != cglCtx ) {
@@ -537,7 +538,6 @@ static const GLfloat gl_verts[] = {
{
DBG_PRINT("MyNSOpenGLLayer::dealloc.0 %p (refcnt %d)\n", self, (int)[self retainCount]);
// NSLog(@"MyNSOpenGLLayer::dealloc: %@",[NSThread callStackSymbols]);
-
[self disableAnimation];
pthread_mutex_lock(&renderLock);
[self deallocPBuffer];
@@ -555,13 +555,23 @@ static const GLfloat gl_verts[] = {
- (void)resizeWithOldSuperlayerSize:(CGSize)size
{
- CGRect lRectS = [[self superlayer] bounds];
-
- DBG_PRINT("MyNSOpenGLLayer::resizeWithOldSuperlayerSize: %p, texSize %dx%d, bounds: %lfx%lf -> %lf/%lf %lfx%lf (refcnt %d)\n",
- self, texWidth, texHeight, size.width, size.height, lRectS.origin.x, lRectS.origin.y, lRectS.size.width, lRectS.size.height, (int)[self retainCount]);
+ CALayer * superL = [self superlayer];
+ CGRect lRectSFrame = [superL frame];
+
+ DBG_PRINT("MyNSOpenGLLayer::resizeWithOldSuperlayerSize: %p, texSize %dx%d -> size: %lfx%lf ; Super Frame[%lf/%lf %lfx%lf] (refcnt %d)\n",
+ self, texWidth, texHeight, size.width, size.height,
+ lRectSFrame.origin.x, lRectSFrame.origin.y, lRectSFrame.size.width, lRectSFrame.size.height,
+ (int)[self retainCount]);
+
+ // With Java7 our root CALayer's frame gets off-limit -> force 0/0 origin!
+ if( lRectSFrame.origin.x!=0 || lRectSFrame.origin.y!=0 ) {
+ lRectSFrame.origin.x = 0;
+ lRectSFrame.origin.y = 0;
+ [superL setPosition: lRectSFrame.origin];
+ }
- newTexWidth = lRectS.size.width;
- newTexHeight = lRectS.size.height;
+ newTexWidth = lRectSFrame.size.width;
+ newTexHeight = lRectSFrame.size.height;
shallDraw = [self isGLSourceValid];
SYNC_PRINT("<SZ %dx%d>", newTexWidth, newTexHeight);
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index 007a917a6..d65f8c231 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -130,7 +130,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
if(changed) {
if(DEBUG) {
System.err.println("JAWTWindow.updateBounds: "+bounds+" -> "+jb);
- Thread.dumpStack();
+ // Thread.dumpStack();
}
bounds.setX(jawtBounds.getX());
bounds.setY(jawtBounds.getY());
@@ -205,7 +205,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
try {
if(DEBUG) {
- System.err.println("JAWTWindow.attachSurfaceHandle(): "+toHexString(layerHandle) + ", bounds "+bounds);
+ System.err.println("JAWTWindow.attachSurfaceHandle: "+toHexString(layerHandle) + ", bounds "+bounds);
}
attachSurfaceLayerImpl(layerHandle);
offscreenSurfaceLayer = layerHandle;
@@ -216,6 +216,17 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
protected abstract void attachSurfaceLayerImpl(final long layerHandle);
@Override
+ public void layoutSurfaceLayer() throws NativeWindowException {
+ if( !isOffscreenLayerSurfaceEnabled() ) {
+ throw new NativeWindowException("Not an offscreen layer surface");
+ }
+ if( 0 != offscreenSurfaceLayer) {
+ layoutSurfaceLayerImpl();
+ }
+ }
+ protected void layoutSurfaceLayerImpl() {}
+
+ @Override
public final void detachSurfaceLayer() throws NativeWindowException {
if( !isOffscreenLayerSurfaceEnabled() ) {
throw new java.lang.UnsupportedOperationException("Not an offscreen layer surface");
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
index ba60a7f38..4885d5a4c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
@@ -46,6 +46,21 @@ public interface OffscreenLayerSurface {
*/
public void attachSurfaceLayer(final long layerHandle) throws NativeWindowException;
+ /**
+ * Layout the offscreen layer according to the implementing class's constraints.
+ * <p>
+ * This method allows triggering a re-layout of the offscreen surface
+ * in case the implementation requires it.
+ * </p>
+ * <p>
+ * Call this method if any parent or ancestor's layout has been changed,
+ * which could affects the layout of this surface.
+ * </p>
+ * @see #isOffscreenLayerSurfaceEnabled()
+ * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
+ */
+ public void layoutSurfaceLayer() throws NativeWindowException;
+
/**
* Detaches a previously attached offscreen layer from this offscreen layer surface.
* @see #attachSurfaceLayer(long)
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
index 9b06cce1a..b25836d3c 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
@@ -118,10 +118,20 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
OSXUtil.AddCASublayer(rootSurfaceLayerHandle, layerHandle);
}
+ protected void layoutSurfaceLayerImpl() {
+ final long osl = getAttachedSurfaceLayer();
+ final int w = getWidth();
+ final int h = getHeight();
+ if(DEBUG) {
+ System.err.println("JAWTWindow.fixSurfaceLayerLayout: "+toHexString(osl) + ", bounds "+bounds+", "+w+"x"+h);
+ }
+ OSXUtil.FixCALayerPosition(rootSurfaceLayerHandle, osl, w, h);
+ }
+
protected void detachSurfaceLayerImpl(final long layerHandle) {
OSXUtil.RemoveCASublayer(rootSurfaceLayerHandle, layerHandle);
}
-
+
@Override
public final long getWindowHandle() {
return windowHandle;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index d85d1a84b..5ff451cc0 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -149,7 +149,7 @@ public class OSXUtil implements ToolkitProperties {
}
/**
- * Attach a sub CALayer to the root CALayer on the main-thread.
+ * Attach a sub CALayer to the root CALayer on the main-thread w/ blocking.
* <p>
* Method will trigger a <code>display</code>
* call to the CALayer hierarchy to enforce resource creation if required, e.g. an NSOpenGLContext.
@@ -173,7 +173,30 @@ public class OSXUtil implements ToolkitProperties {
}
/**
- * Detach a sub CALayer from the root CALayer on the main-thread.
+ * Fix root and sub CALayer position to 0/0 on the main-thread w/o blocking.
+ * <p>
+ * For an unknown reason, on OSX/Java7 our root CALayer's frame position gets corrupted
+ * and is moved out of 'sight' .. or oddly half way to the upper right corner.
+ * </p>
+ *
+ * @param rootCALayer the root surface layer, maybe null.
+ * @param subCALayer the client surface layer, maybe null.
+ * @param width the expected width
+ * @param height the expected height
+ */
+ public static void FixCALayerPosition(final long rootCALayer, final long subCALayer, final int width, final int height) {
+ if( 0==rootCALayer && 0==subCALayer ) {
+ return;
+ }
+ RunOnMainThread(false, new Runnable() {
+ public void run() {
+ FixCALayerPosition0(rootCALayer, subCALayer, width, height);
+ }
+ });
+ }
+
+ /**
+ * Detach a sub CALayer from the root CALayer on the main-thread w/ blocking.
*/
public static void RemoveCASublayer(final long rootCALayer, final long subCALayer) {
if(0==rootCALayer || 0==subCALayer) {
@@ -186,7 +209,7 @@ public class OSXUtil implements ToolkitProperties {
}
/**
- * Destroy a CALayer on the main-thread.
+ * Destroy a CALayer on the main-thread w/ blocking.
* @see #CreateCALayer(int, int, int, int)
*/
public static void DestroyCALayer(final long caLayer) {
@@ -323,6 +346,7 @@ public class OSXUtil implements ToolkitProperties {
private static native long GetNSWindow0(long nsView);
private static native long CreateCALayer0(int x, int y, int width, int height);
private static native void AddCASublayer0(long rootCALayer, long subCALayer);
+ private static native void FixCALayerPosition0(long rootCALayer, long subCALayer, int width, int height);
private static native void RemoveCASublayer0(long rootCALayer, long subCALayer);
private static native void DestroyCALayer0(long caLayer);
private static native void RunOnMainThread0(Runnable runnable);
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index 4c07b4df7..28e63e875 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -429,11 +429,13 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer);
+ [subLayer retain]; // Pairs w/ RemoveCASublayer
+
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
CGRect lRectRoot = [rootLayer frame];
- DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n",
+ DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n",
rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
if(lRectRoot.origin.x!=0 || lRectRoot.origin.y!=0) {
lRectRoot.origin.x = 0;
@@ -476,6 +478,57 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
+ * Method: FixCALayerPosition0
+ * Signature: (JJII)V
+ */
+JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_FixCALayerPosition0
+ (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height)
+{
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
+ CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer);
+
+ [CATransaction begin];
+ [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
+
+ if( NULL != rootLayer ) {
+ CGRect lRect = [rootLayer frame];
+ DBG_PRINT("CALayer::FixCALayerPosition0.0: Root Origin %p exp 0/0 %dx%d frame0: %lf/%lf %lfx%lf\n",
+ rootLayer, width, height, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
+ if(lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=width || lRect.size.height!=height) {
+ lRect.origin.x = 0;
+ lRect.origin.y = 0;
+ lRect.size.width = width;
+ lRect.size.height = height;
+ [rootLayer setFrame: lRect];
+ DBG_PRINT("CALayer::FixCALayerPosition0.1: Root Origin %p frame*: %lf/%lf %lfx%lf\n",
+ rootLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
+ }
+ }
+ if( NULL != subLayer ) {
+ CGRect lRect = [subLayer frame];
+ DBG_PRINT("CALayer::FixCALayerPosition0.0: SubL %p exp 0/0 %dx%d frame0: %lf/%lf %lfx%lf\n",
+ subLayer, width, height, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
+ if(lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=width || lRect.size.height!=height) {
+ lRect.origin.x = 0;
+ lRect.origin.y = 0;
+ lRect.size.width = width;
+ lRect.size.height = height;
+ [subLayer setFrame: lRect];
+ DBG_PRINT("CALayer::FixCALayerPosition0.1: SubL Origin %p frame*: %lf/%lf %lfx%lf\n",
+ subLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
+ }
+ }
+
+ [CATransaction commit];
+
+ [pool release];
+ DBG_PRINT("CALayer::FixCALayerPosition0.X: root %p (refcnt %d) .sub %p (refcnt %d)\n",
+ rootLayer, (int)[rootLayer retainCount], subLayer, (int)[subLayer retainCount]);
+}
+
+/*
+ * Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: RemoveCASublayer0
* Signature: (JJ)V
*/
@@ -495,7 +548,7 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_RemoveCASublayer0
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
[subLayer removeFromSuperlayer];
- // [subLayer release] is called explicitly, e.g. via CGL.releaseNSOpenGLLayer(..) (MyNSOpenGLLayer::releaseLayer)
+ [subLayer release]; // Pairs w/ AddCASublayer
[CATransaction commit];
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 195f8af8c..524917780 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -391,6 +391,18 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
reparentWindow(true, cont);
}
+ @SuppressWarnings("deprecation")
+ @Override
+ public void reshape(int x, int y, int width, int height) {
+ super.reshape(x, y, width, height);
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.reshape: "+x+"/"+y+" "+width+"x"+height);
+ }
+ if(null != jawtWindow && jawtWindow.isOffscreenLayerSurfaceEnabled() ) {
+ jawtWindow.layoutSurfaceLayer();
+ }
+ }
+
@Override
public void removeNotify() {
java.awt.Container cont = AWTMisc.getContainer(this);
@@ -459,7 +471,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
// force this AWT Canvas to be focus-able,
// since this it is completely covered by the newtChild (z-order).
- setFocusable(true);
+ setFocusable(true);
} else {
configureNewtChild(false);
newtChild.setVisible(false);
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 08c7a14c2..f47ca327d 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -227,7 +227,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
} // else offscreen size is realized via recreation
// no native event (fullscreen, some reparenting)
positionChanged(true, x, y);
- sizeChanged(true, width, height, false); // incl. validation (incl. repositioning)
+ sizeChanged(true, width, height, false);
}
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && 0 != ( FLAG_IS_VISIBLE & flags) ) {
if( !isOffscreenInstance ) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
index 8d1ad57b4..447c6b94c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
@@ -77,13 +77,12 @@ public class TestGearsES2AWT extends UITestCase {
static int swapInterval = 1;
static boolean exclusiveContext = false;
static Thread awtEDT;
- static Dimension rwsize;
+ static Dimension rwsize = null;
@BeforeClass
public static void initClass() {
width = 640;
height = 480;
- rwsize = null;
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index 52ce425a8..47891a8df 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -71,7 +71,7 @@ import org.junit.Test;
public class TestGearsES2NEWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
- static DimensionImmutable wsize, rwsize;
+ static DimensionImmutable wsize, rwsize=null;
static long duration = 500; // ms
static boolean opaque = true;
@@ -96,7 +96,6 @@ public class TestGearsES2NEWT extends UITestCase {
public static void initClass() {
if(null == wsize) {
wsize = new Dimension(640, 480);
- rwsize = null;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
index 035ed624a..f98cb240b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
@@ -78,7 +78,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
- static DimensionImmutable wsize, rwsize;
+ static DimensionImmutable wsize, rwsize = null;
static long duration = 500; // ms
static boolean opaque = true;
@@ -99,7 +99,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
public static void initClass() {
if(null == wsize) {
wsize = new Dimension(640, 480);
- rwsize = null;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
index 112a1282d..cb2cf064f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
@@ -73,7 +73,7 @@ import org.junit.Test;
public class TestGearsES2NewtCanvasSWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
- static DimensionImmutable wsize, rwsize;
+ static DimensionImmutable wsize, rwsize = null;
static long duration = 500; // ms
static boolean opaque = true;
@@ -93,7 +93,6 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
public static void initClass() {
if(null == wsize) {
wsize = new Dimension(640, 480);
- rwsize = new Dimension(-1, -1);
}
}
@@ -219,7 +218,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
- if( 0 < rwsize.getWidth() && 0 < rwsize.getHeight() ) {
+ if( null != rwsize ) {
for(int i=0; i<50; i++) { // 500 ms dispatched delay
if( !display.readAndDispatch() ) {
// blocks on linux .. display.sleep();
@@ -349,7 +348,9 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
}
}
wsize = new Dimension(w, h);
- rwsize = new Dimension(rw, rh);
+ if( 0 < rw && 0 < rh ) {
+ rwsize = new Dimension(rw, rh);
+ }
if(usePos) {
wpos = new Point(x, y);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
index 45bd3bb39..08e4ac26a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
@@ -65,7 +65,7 @@ import org.junit.Test;
public class TestGearsES2SWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
- static DimensionImmutable wsize, rwsize;
+ static DimensionImmutable wsize, rwsize=null;
static long duration = 500; // ms
static boolean opaque = true;
@@ -85,7 +85,6 @@ public class TestGearsES2SWT extends UITestCase {
public static void initClass() {
if(null == wsize) {
wsize = new Dimension(640, 480);
- rwsize = null;
}
}