Jogamp
Bug 1211: Adopt changes to unit test from commit 68c8e39fa8d6e700f0a99241c1a01a435b7f6284
authorSven Gothel <sgothel@jausoft.com>
Tue, 15 Sep 2015 05:54:07 +0000 (07:54 +0200)
committerSven Gothel <sgothel@jausoft.com>
Tue, 15 Sep 2015 05:54:07 +0000 (07:54 +0200)
48 files changed:
make/scripts/tests.sh
src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedExternalContextAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java
src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java
src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java
src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
src/test/com/jogamp/opengl/test/junit/newt/TestBug1211IRQ00NEWT.java
src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java
src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java [deleted file]

index db5b42b..bbb926b 100644 (file)
@@ -470,7 +470,7 @@ function testawtswt() {
 # av demos
 #
 #testnoawt jogamp.opengl.openal.av.ALDummyUsage $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
 #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
 #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.CrossFadePlayer $*
 
@@ -630,7 +630,7 @@ function testawtswt() {
 #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindowInvisiblePointer01NEWT $*
 #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT
 #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT
-testnoawt com.jogamp.opengl.test.junit.newt.TestBug1211IRQ00NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.newt.TestBug1211IRQ00NEWT $*
 #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
 #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00aNEWT $*
 #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00bNEWT $*
index e4fabbb..eff2aae 100644 (file)
@@ -36,6 +36,7 @@ import com.jogamp.opengl.GLProfile;
 
 import jogamp.newt.driver.android.NewtBaseActivity;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.event.MonitorEvent;
 import com.jogamp.newt.event.MouseAdapter;
 import com.jogamp.newt.event.MouseEvent;
@@ -90,7 +91,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
             public void mousePressed(final MouseEvent e) {
                 if( e.getPointerCount() == 3 ) {
                     Log.d(TAG, "MemoryHog");
-                    new Thread(new Runnable() {
+                    new InterruptSource.Thread(null, new Runnable() {
                         public void run() {
                             final ArrayList<Buffer> buffers = new ArrayList<Buffer>();
                             while(true) {
index 89d28c0..7430dcd 100644 (file)
@@ -27,7 +27,7 @@ import com.jogamp.opengl.GLRunnable;
 import com.jogamp.opengl.GLUniformData;
 import com.jogamp.opengl.awt.GLCanvas;
 import com.jogamp.opengl.glu.GLU;
-
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.awt.NewtCanvasAWT;
 import com.jogamp.newt.opengl.GLWindow;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -98,7 +98,7 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
   }
 
   public void start() {
-    thread = new Thread(this, "Animation Thread");
+    thread = new InterruptSource.Thread(null, this, "Animation Thread");
     thread.start();
   }
 
index 5019391..b31a5f4 100644 (file)
@@ -27,7 +27,7 @@ import com.jogamp.opengl.GLRunnable;
 import com.jogamp.opengl.GLUniformData;
 import com.jogamp.opengl.awt.GLCanvas;
 import com.jogamp.opengl.glu.GLU;
-
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.awt.NewtCanvasAWT;
 import com.jogamp.newt.opengl.GLWindow;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -100,7 +100,7 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
   }
 
   public void start() {
-    thread = new Thread(this, "Animation Thread");
+    thread = new InterruptSource.Thread(null, this, "Animation Thread");
     thread.start();
   }
 
index 1228f14..d0e4448 100644 (file)
@@ -20,7 +20,8 @@ import com.jogamp.opengl.GLCapabilities;
 import com.jogamp.opengl.GLEventListener;
 import com.jogamp.opengl.GLProfile;
 import com.jogamp.opengl.awt.GLCanvas;
-
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.junit.util.JunitTracer;
 import com.jogamp.newt.awt.NewtCanvasAWT;
 import com.jogamp.newt.opengl.GLWindow;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -82,7 +83,7 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
 
   public void start() {
     initDraw();
-    thread = new Thread(this, "Animation Thread");
+    thread = new InterruptSource.Thread(null, this, "Animation Thread");
     thread.start();
   }
 
@@ -219,7 +220,7 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
     System.err.println("swapInterval "+SWAP_INTERVAL);
     System.err.println("exclusiveContext "+USE_ECT);
     if(waitForKey) {
-        UITestCase.waitForKey("Start");
+        JunitTracer.waitForKey("Start");
     }
 
     final GraphicsEnvironment environment =
index 184a2ef..7532ca6 100644 (file)
@@ -6,6 +6,7 @@ import java.awt.Frame;
 import java.awt.event.*;
 import java.awt.geom.*;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.opengl.GL;
 import com.jogamp.opengl.GL2;
 import com.jogamp.opengl.GLAutoDrawable;
@@ -49,7 +50,7 @@ public abstract class Issue344Base implements GLEventListener
         frame.setSize(512, 512);
         frame.addWindowListener(new WindowAdapter() {
                 public void windowClosing(final WindowEvent e) {
-                    new Thread(new Runnable() {
+                    new InterruptSource.Thread(null, new Runnable() {
                             public void run() {
                                 System.exit(0);
                             }
index 4bb72bb..3f5c522 100644 (file)
@@ -16,6 +16,7 @@ import com.jogamp.opengl.GLPipelineFactory;
 import com.jogamp.opengl.GLRunnable;
 
 import com.jogamp.common.net.Uri;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.graph.curve.Region;
 import com.jogamp.graph.curve.opengl.RegionRenderer;
 import com.jogamp.graph.curve.opengl.RenderState;
@@ -354,7 +355,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
         button.addMouseListener(new UIShape.MouseGestureAdapter() {
             @Override
             public void mouseClicked(final MouseEvent e) {
-                new Thread() {
+                new InterruptSource.Thread() {
                     public void run() {
                         if( null != cDrawable ) {
                             final GLAnimatorControl actrl = cDrawable.getAnimator();
index bdde61a..83fc6ca 100644 (file)
@@ -28,7 +28,7 @@
 package com.jogamp.opengl.test.junit.graph.demos.ui;
 
 import com.jogamp.opengl.GL2ES2;
-
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.graph.curve.opengl.RegionRenderer;
 import com.jogamp.graph.geom.Vertex;
 import com.jogamp.graph.geom.Vertex.Factory;
@@ -91,7 +91,7 @@ public class MediaPlayerButton extends TextureSeqButton {
                     // FIXME: mPlayer.resetGLState();
                 }
                 if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             // loop for-ever ..
                             mPlayer.seek(0);
index 3379129..7a5b491 100644 (file)
@@ -28,6 +28,8 @@
 
 package com.jogamp.opengl.test.junit.jogl.acore;
 
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.common.util.InterruptedRuntimeException;
 import com.jogamp.nativewindow.Capabilities;
 import com.jogamp.nativewindow.util.InsetsImmutable;
 import com.jogamp.opengl.GLCapabilities;
@@ -194,11 +196,11 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase {
         final String currentThreadName = Thread.currentThread().getName();
         final Object syncDone = new Object();
         final JOGLTask[] tasks = new JOGLTask[num];
-        final Thread[] threads = new Thread[num];
+        final InterruptSource.Thread[] threads = new InterruptSource.Thread[num];
         int i;
         for(i=0; i<num; i++) {
             tasks[i] = new JOGLTask(syncDone, i, reuse);
-            threads[i] = new Thread(tasks[i], currentThreadName+"-jt"+i);
+            threads[i] = new InterruptSource.Thread(null, tasks[i], currentThreadName+"-jt"+i);
         }
         final long t0 = System.currentTimeMillis();
 
@@ -211,7 +213,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase {
                 try {
                     syncDone.wait(500);
                 } catch (final InterruptedException e) {
-                    throw new RuntimeException(e);
+                    throw new InterruptedRuntimeException(e);
                 }
                 System.err.println(i+": "+doneDump(tasks));
                 i++;
index 42646c0..a736a48 100644 (file)
@@ -52,6 +52,7 @@ import org.junit.Test;
 import org.junit.runners.MethodSorters;
 
 import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.opengl.GLCapabilities;
 import com.jogamp.opengl.GLCapabilitiesImmutable;
 import com.jogamp.opengl.GLProfile;
@@ -127,7 +128,7 @@ public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
         final String cancelButtonText = UIManager.getString("FileChooser.cancelButtonText",l);
 
         // launch robot action ..
-        new Thread()
+        new InterruptSource.Thread()
         {
             public void run()
             {
@@ -161,7 +162,7 @@ public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
                     // hover to 'approve' -> tool tip
                     if( null != approveButtonPos ) {
                         AWTRobotUtil.mouseMove(robot, approveButtonPos, MOVE_ITER, MOVE_DELAY);
-                        Thread.sleep(TOOLTIP_WAIT);
+                        java.lang.Thread.sleep(TOOLTIP_WAIT);
                         try {
                             SwingUtilities.invokeAndWait(new Runnable() {
                                 public void run() {
index fd012e8..a034f9c 100644 (file)
@@ -44,6 +44,7 @@ import org.junit.Test;
 import org.junit.FixMethodOrder;
 import org.junit.runners.MethodSorters;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.common.util.RunnableTask;
 import com.jogamp.opengl.test.junit.util.UITestCase;
 
@@ -83,7 +84,7 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
                 System.err.println("BB.0: "+rTask.getSyncObject());
                 synchronized (rTask.getSyncObject()) {
                     System.err.println("BB.1: "+rTask.getSyncObject());
-                    new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
+                    new InterruptSource.Thread(null, rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
                     try {
                         System.err.println("BB.2");
                         rTask.getSyncObject().wait();
index f2e8b86..d8900b4 100644 (file)
@@ -32,6 +32,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.event.KeyAdapter;
 import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.event.WindowEvent;
@@ -114,7 +115,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
                     if( 3 == c ) {
                         demo.setMSAA(4);
                     } else if( 6 == c ) {
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             @Override
                             public void run() {
                                 glWindow.setSize(dw+64, dh+64);
@@ -124,14 +125,14 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
                     } else if( 12 == c ) {
                         demo.setMSAA(0);
                     } else if( 15 == c ) {
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             @Override
                             public void run() {
                                 glWindow.setSize(dw+128, dh+128);
                             } }.start();
                     } else if( 18 == c ) {
                         c=0;
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             @Override
                             public void run() {
                                 glWindow.setSize(dw+256, dh+256);
@@ -167,7 +168,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
                 }
                 System.err.println("*** "+e);
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             System.err.println("[set fullscreen  pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
                             glWindow.setFullscreen(!glWindow.isFullscreen());
index 26d510a..6c1e4b8 100644 (file)
@@ -48,7 +48,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.nativewindow.NativeSurface;
 import com.jogamp.nativewindow.SurfaceUpdatedListener;
 import com.jogamp.opengl.GL;
@@ -192,7 +192,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
                     }
                     if(9 == c) {
                         c=0;
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             @Override
                             public void run() {
                                 glWindow.setSize(dw+256, dh+256);
index 0586eef..1886d3d 100644 (file)
@@ -46,7 +46,7 @@ import com.jogamp.opengl.util.texture.TextureIO;
 import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2;
-
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.nativewindow.NativeSurface;
 import com.jogamp.nativewindow.SurfaceUpdatedListener;
 import com.jogamp.opengl.GL;
@@ -178,7 +178,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
                     }
                     if(9 == c) {
                         c=0;
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             @Override
                             public void run() {
                                 glWindow.setSize(dw+256, dh+256);
index 1e78691..8d26ebb 100644 (file)
@@ -31,6 +31,7 @@ package com.jogamp.opengl.test.junit.jogl.acore;
 import java.io.IOException;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.nativewindow.NativeSurface;
 import com.jogamp.opengl.GLAutoDrawable;
 import com.jogamp.opengl.GLCapabilities;
@@ -194,8 +195,8 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
         final Object sync = new Object();
         final MyRunnable[] animTasks = new MyRunnable[animThreadCount];
         final MyRunnable[] resizeTasks = new MyRunnable[animThreadCount];
-        final Thread[] animThreads = new Thread[reszThreadCount];
-        final Thread[] resizeThreads = new Thread[reszThreadCount];
+        final InterruptSource.Thread[] animThreads = new InterruptSource.Thread[reszThreadCount];
+        final InterruptSource.Thread[] resizeThreads = new InterruptSource.Thread[reszThreadCount];
 
         System.err.println("animThreadCount "+animThreadCount+", frameCount "+frameCount);
         System.err.println("reszThreadCount "+reszThreadCount+", resizeCount "+resizeCount);
@@ -204,12 +205,12 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
         for(int i=0; i<animThreadCount; i++) {
             System.err.println("create anim task/thread "+i);
             animTasks[i] = new RudeAnimator(glWindow, frameCount, sync, i);
-            animThreads[i] = new Thread(animTasks[i], currentThreadName+"-anim"+i);
+            animThreads[i] = new InterruptSource.Thread(null, animTasks[i], currentThreadName+"-anim"+i);
         }
         for(int i=0; i<reszThreadCount; i++) {
             System.err.println("create resz task/thread "+i);
             resizeTasks[i] = new RudeResizer(glWindow, resizeCount, sync, i);
-            resizeThreads[i] = new Thread(resizeTasks[i], currentThreadName+"-resz"+i);
+            resizeThreads[i] = new InterruptSource.Thread(null, resizeTasks[i], currentThreadName+"-resz"+i);
         }
 
         myEventCounter.reset();
index 65925c6..b052087 100644 (file)
@@ -49,6 +49,7 @@ import org.junit.Test;
 import org.junit.FixMethodOrder;
 import org.junit.runners.MethodSorters;
 
+import com.jogamp.junit.util.JunitTracer;
 import com.jogamp.newt.Window;
 import com.jogamp.newt.awt.NewtCanvasAWT;
 import com.jogamp.newt.opengl.GLWindow;
@@ -162,7 +163,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
         }
         setDemoFields(demo1, glWindow1, false);
         glWindow1.addGLEventListener(demo1);
-        glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
+        glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
 
         frame1.setSize(frameSize0);
         setupFrameAndShow(frame1, newtCanvasAWT1);
@@ -189,7 +190,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
 
         end(animator1, frame1, glWindow1);
         if( waitForKey ) {
-            UITestCase.waitForKey("Continue");
+            JunitTracer.waitForKey("Continue");
         }
     }
 
@@ -234,7 +235,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
             }
         }
         if(waitForKey) {
-            UITestCase.waitForKey("Start");
+            JunitTracer.waitForKey("Start");
         }
         final String tstname = TestOffscreenLayer02NewtCanvasAWT.class.getName();
         /*
index aef64e4..ae9dac0 100644 (file)
@@ -43,6 +43,7 @@ import org.junit.Test;
 import org.junit.FixMethodOrder;
 import org.junit.runners.MethodSorters;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.common.util.RunnableTask;
 import com.jogamp.opengl.test.junit.util.UITestCase;
 
@@ -82,7 +83,7 @@ public class TestPBufferDeadlockAWT extends UITestCase {
                 System.err.println("BB.0: "+rTask.getSyncObject());
                 synchronized (rTask.getSyncObject()) {
                     System.err.println("BB.1: "+rTask.getSyncObject());
-                    new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
+                    new InterruptSource.Thread(null, rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
                     try {
                         System.err.println("BB.2");
                         rTask.getSyncObject().wait();
index 81489df..0987b29 100644 (file)
@@ -14,6 +14,7 @@ import javax.swing.Timer;
 import org.junit.Test;
 
 import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.common.util.locks.LockFactory;
 import com.jogamp.common.util.locks.RecursiveLock;
 import com.jogamp.opengl.*;
@@ -69,7 +70,7 @@ public class TestSharedExternalContextAWT {
     // which is suppose to lie outside of the JVM.
     // The thread is kept alive, since this detail
     // may be required for the OpenGL driver implementation.
-    final Thread thread = new Thread(runnable);
+    final Thread thread = new InterruptSource.Thread(null, runnable);
     thread.setDaemon(true);
     thread.start();
     masterLatch.await(3, TimeUnit.SECONDS);
index b30bb11..4cdcbd1 100644 (file)
@@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore.anim;
 import java.awt.BorderLayout;
 import java.awt.Dimension;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.opengl.GLAutoDrawable;
 import com.jogamp.opengl.GLCapabilities;
 import com.jogamp.opengl.GLEventListener;
@@ -85,10 +86,10 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame {
                     lastTime = time;
                     animator.pause();
                     System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.pause(): paused "+animator);
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             try {
-                                Thread.sleep(1000);
+                                java.lang.Thread.sleep(1000);
                             } catch (final InterruptedException e) {
                                 e.printStackTrace();
                             }
@@ -98,9 +99,9 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame {
                                     final long td = System.currentTimeMillis() - lastTime;
                                     if (animator.isPaused()) {
                                         animator.resume(); //Doesn't work on v2.0.2 or higher
-                                        System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator);
+                                        System.out.println(java.lang.Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator);
                                     } else {
-                                        System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator);
+                                        System.out.println(java.lang.Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator);
                                     }
                                 } } );
                         }
index f3c2734..dfd2489 100644 (file)
@@ -28,6 +28,8 @@
 
 package com.jogamp.opengl.test.junit.jogl.caps;
 
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.junit.util.JunitTracer;
 import com.jogamp.newt.event.KeyAdapter;
 import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.opengl.GLWindow;
@@ -92,12 +94,12 @@ public class TestTranslucencyNEWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
                     } }.start();
                 } else if(e.getKeyChar()=='d') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
                     } }.start();
@@ -157,7 +159,7 @@ public class TestTranslucencyNEWT extends UITestCase {
             }
         }
         if( waitForKey ) {
-            UITestCase.waitForKey("main");
+            JunitTracer.waitForKey("main");
         }
         org.junit.runner.JUnitCore.main(TestTranslucencyNEWT.class.getName());
     }
index 771748a..4326527 100644 (file)
@@ -28,6 +28,7 @@
 
 package com.jogamp.opengl.test.junit.jogl.demos.es1.newt;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.event.KeyAdapter;
 import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.opengl.GLWindow;
@@ -92,12 +93,12 @@ public class TestGearsES1NEWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
                     } }.start();
                 } else if(e.getKeyChar()=='d') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
                     } }.start();
index 9bf04a7..769183e 100644 (file)
@@ -28,6 +28,7 @@
 
 package com.jogamp.opengl.test.junit.jogl.demos.es1.newt;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.event.KeyAdapter;
 import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.opengl.GLWindow;
@@ -90,12 +91,12 @@ public class TestRedSquareES1NEWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
                     } }.start();
                 } else if(e.getKeyChar()=='d') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
                     } }.start();
index b2ebc70..cc40966 100644 (file)
@@ -29,6 +29,7 @@
 package com.jogamp.opengl.test.junit.jogl.demos.es2.av;\r
 \r
 import com.jogamp.common.net.Uri;\r
+import com.jogamp.common.util.InterruptSource;\r
 import com.jogamp.opengl.util.av.AudioSink;\r
 import com.jogamp.opengl.util.av.GLMediaPlayer;\r
 import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;\r
@@ -73,7 +74,7 @@ public class CrossFadePlayer
                                        System.out.println("Duration: " + mp.getDuration() + "ms");\r
                                        System.out.println("Volume: " + mp.getAudioVolume());\r
                                        System.out.println("player.initGL()...");\r
-                    new Thread() {\r
+                    new InterruptSource.Thread() {\r
                         public void run() {\r
                             try {\r
                                 mp.initGL(null);\r
@@ -98,7 +99,7 @@ public class CrossFadePlayer
                         stop = true;\r
                     } else {\r
                         System.err.println("Player State: EOS");\r
-                        new Thread() {\r
+                        new InterruptSource.Thread() {\r
                             public void run() {\r
                                 System.out.println("mp.setPlaySpeed(1f) returned: " + mp.setPlaySpeed(1f));\r
                                 mp.seek(0);\r
@@ -112,7 +113,7 @@ public class CrossFadePlayer
                                        if( null != se ) {\r
                                                se.printStackTrace();\r
                                        }\r
-                                       new Thread() {\r
+                                       new InterruptSource.Thread() {\r
                                                public void run() {\r
                                                        System.out.println("terminating...");\r
                                                        stop = true;\r
index 5259951..a8dede5 100644 (file)
@@ -42,6 +42,7 @@ import com.jogamp.opengl.GLException;
 import com.jogamp.opengl.GLProfile;
 
 import com.jogamp.common.net.Uri;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.graph.curve.Region;
 import com.jogamp.graph.curve.opengl.GLRegion;
 import com.jogamp.graph.curve.opengl.RegionRenderer;
@@ -116,7 +117,7 @@ public class MovieCube implements GLEventListener {
                     resetGLState();
                 }
                 if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             // loop for-ever ..
                             mPlayer.seek(0);
@@ -599,7 +600,7 @@ public class MovieCube implements GLEventListener {
                     if( null != se ) {
                         se.printStackTrace();
                     }
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             window.destroy();
                         } }.start();
index e936bf9..9b90737 100644 (file)
@@ -42,6 +42,7 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
 
 import com.jogamp.common.net.Uri;
 import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.graph.curve.Region;
 import com.jogamp.graph.curve.opengl.GLRegion;
 import com.jogamp.graph.curve.opengl.RegionRenderer;
@@ -800,7 +801,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
 
     static class StereoGLMediaEventListener implements GLMediaEventListener {
             void destroyWindow(final Window window) {
-                new Thread() {
+                new InterruptSource.Thread() {
                     public void run() {
                         window.destroy();
                     } }.start();
@@ -846,7 +847,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
                         destroy = true;
                     } else {
                         System.err.println("MovieSimple State: EOS");
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             public void run() {
                                 mp.setPlaySpeed(1f);
                                 mp.seek(0);
index ac5d298..0676a5a 100644 (file)
@@ -47,6 +47,7 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
 
 import com.jogamp.common.net.Uri;
 import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.graph.curve.Region;
 import com.jogamp.graph.curve.opengl.GLRegion;
 import com.jogamp.graph.curve.opengl.RegionRenderer;
@@ -355,7 +356,7 @@ public class MovieSimple implements GLEventListener {
                     resetGLState();
                 }
                 if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             // loop for-ever ..
                             mPlayer.seek(0);
@@ -807,7 +808,7 @@ public class MovieSimple implements GLEventListener {
 
     static class MyGLMediaEventListener implements GLMediaEventListener {
             void destroyWindow(final Window window) {
-                new Thread() {
+                new InterruptSource.Thread() {
                     public void run() {
                         window.destroy();
                     } }.start();
@@ -841,7 +842,7 @@ public class MovieSimple implements GLEventListener {
                     /**
                      * Kick off player w/o GLEventListener, i.e. for audio only.
                      *
-                        new Thread() {
+                        new InterruptSource.Thread() {
                             public void run() {
                                 try {
                                     mp.initGL(null);
@@ -873,7 +874,7 @@ public class MovieSimple implements GLEventListener {
                     } else {
                         System.err.println("MovieSimple State: EOS");
                         if( loopEOS ) {
-                            new Thread() {
+                            new InterruptSource.Thread() {
                                 public void run() {
                                     mp.setPlaySpeed(1f);
                                     mp.seek(0);
index 5ecda9e..b389c9a 100644 (file)
@@ -28,6 +28,7 @@
 
 package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.event.KeyAdapter;
 import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.event.TraceWindowAdapter;
@@ -109,12 +110,12 @@ public class TestElektronenMultipliziererNEWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
                     } }.start();
                 } else if(e.getKeyChar()=='d') {
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         public void run() {
                             f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
                     } }.start();
index f0f23eb..39e94ef 100644 (file)
@@ -40,12 +40,11 @@ import com.jogamp.newt.Window;
 import com.jogamp.newt.event.WindowEvent;
 import com.jogamp.newt.event.WindowAdapter;
 import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
 import com.jogamp.newt.util.EDTUtil;
 import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
 import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
 import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
 import com.jogamp.opengl.util.Animator;
 import com.jogamp.opengl.util.AnimatorBase;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -172,12 +171,6 @@ public class TestGearsES2NEWT extends UITestCase {
             animator.setExclusiveContext(exclusiveContext);
         }
 
-        final QuitAdapter quitAdapter = new QuitAdapter();
-        //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
-        //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
-        glWindow.addKeyListener(quitAdapter);
-        glWindow.addWindowListener(quitAdapter);
-
         glWindow.addWindowListener(new WindowAdapter() {
             public void windowResized(final WindowEvent e) {
                 System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
@@ -196,6 +189,7 @@ public class TestGearsES2NEWT extends UITestCase {
         }
 
         final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow, pointerIcons);
+        newtDemoListener.quitAdapterEnable(true);
         glWindow.addKeyListener(newtDemoListener);
         glWindow.addMouseListener(newtDemoListener);
 
@@ -231,7 +225,7 @@ public class TestGearsES2NEWT extends UITestCase {
                                     final EDTUtil edt = ((Window)upstream).getScreen().getDisplay().getEDTUtil();
                                     System.err.println("EDT invokeAndWaitError: edt type "+edt.getClass().getName());
                                     if( edt instanceof DefaultEDTUtil ) {
-                                        quitAdapter.doQuit();
+                                        newtDemoListener.doQuit();
                                         ((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() {
                                             public void run() {
                                                 throw new RuntimeException("XXX Should never ever be seen! - "+Thread.currentThread());
@@ -279,7 +273,7 @@ public class TestGearsES2NEWT extends UITestCase {
 
         final long t0 = System.currentTimeMillis();
         long t1 = t0;
-        while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+        while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
             Thread.sleep(100);
             t1 = System.currentTimeMillis();
             if( SysExit.testError == sysExit || SysExit.testExit == sysExit || SysExit.testEDTError == sysExit) {
@@ -294,7 +288,7 @@ public class TestGearsES2NEWT extends UITestCase {
                         final EDTUtil edt = glWindow.getScreen().getDisplay().getEDTUtil();
                         System.err.println("EDT invokeAndWaitError: edt type "+edt.getClass().getName());
                         if( edt instanceof DefaultEDTUtil ) {
-                            quitAdapter.doQuit();
+                            newtDemoListener.doQuit();
                             ((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() {
                                 public void run() {
                                     throw new RuntimeException("XXX Should never ever be seen!");
index 39d13f6..4e60c4e 100644 (file)
@@ -50,7 +50,6 @@ import com.jogamp.newt.opengl.GLWindow;
 import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
 import com.jogamp.opengl.test.junit.util.MiscUtils;
 import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
 import com.jogamp.opengl.util.Animator;
 import com.jogamp.opengl.util.AnimatorBase;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -272,12 +271,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
             animator.setExclusiveContext(exclusiveContext);
         }
 
-        final QuitAdapter quitAdapter = new QuitAdapter();
-        //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
-        //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
-        glWindow.addKeyListener(quitAdapter);
-        glWindow.addWindowListener(quitAdapter);
-
         glWindow.addWindowListener(new WindowAdapter() {
             public void windowResized(final WindowEvent e) {
                 System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
@@ -287,9 +280,11 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
             }
         });
 
-        final NewtAWTReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter);
+        final NewtAWTReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow);
+        newtDemoListener.quitAdapterEnable(true);
         glWindow.addKeyListener(newtDemoListener);
         glWindow.addMouseListener(newtDemoListener);
+        glWindow.addWindowListener(newtDemoListener);
 
         if( useAnimator ) {
             animator.add(glWindow);
@@ -334,7 +329,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
 
         final long t0 = System.currentTimeMillis();
         long t1 = t0;
-        while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+        while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
             Thread.sleep(100);
             t1 = System.currentTimeMillis();
         }
index 8dcffc6..ee72e1e 100644 (file)
@@ -31,6 +31,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.nativewindow.swt.SWTAccessor;
 import com.jogamp.newt.NewtFactory;
 import com.jogamp.newt.event.KeyAdapter;
@@ -184,14 +185,12 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
-                            final Thread t = glWindow.setExclusiveContextThread(null);
                             System.err.println("[set fullscreen  pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
                             glWindow.setFullscreen(!glWindow.isFullscreen());
                             System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
-                            glWindow.setExclusiveContextThread(t);
-                    } }.start();
+                    } } );
                 }
             }
         });
index d109c56..849fcb1 100644 (file)
@@ -40,9 +40,9 @@ import com.jogamp.newt.Window;
 import com.jogamp.newt.event.WindowEvent;
 import com.jogamp.newt.event.WindowAdapter;
 import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
 import com.jogamp.opengl.test.junit.util.UITestCase;
 import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
 import com.jogamp.opengl.test.junit.util.QuitAdapter;
 import com.jogamp.opengl.util.Animator;
 import com.jogamp.opengl.util.PNGPixelRect;
index 79c8cb3..2c5b602 100644 (file)
@@ -87,15 +87,15 @@ public class TestLandscapeES2NEWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
                             glWindow.setFullscreen(!glWindow.isFullscreen());
-                    } }.start();
+                    } } );
                 } else if(e.getKeyChar()=='d') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
                             glWindow.setUndecorated(!glWindow.isUndecorated());
-                    } }.start();
+                    } } );
                 }
             }
         });
index 12ea6db..f73eb67 100644 (file)
@@ -41,7 +41,6 @@ import com.jogamp.newt.event.WindowAdapter;
 import com.jogamp.newt.opengl.GLWindow;
 import com.jogamp.opengl.test.junit.util.MiscUtils;
 import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
 import com.jogamp.opengl.util.Animator;
 import com.jogamp.opengl.util.AnimatorBase;
 import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -104,12 +103,6 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
             animator.setExclusiveContext(exclusiveContext);
         }
 
-        final QuitAdapter quitAdapter = new QuitAdapter();
-        //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
-        //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
-        glWindow.addKeyListener(quitAdapter);
-        glWindow.addWindowListener(quitAdapter);
-
         glWindow.addWindowListener(new WindowAdapter() {
             public void windowResized(final WindowEvent e) {
                 System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
@@ -119,7 +112,10 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
             }
         });
 
-        glWindow.addKeyListener(new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter));
+        final NewtAWTReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow);
+        newtDemoListener.quitAdapterEnable(true);
+        glWindow.addKeyListener(newtDemoListener);
+        glWindow.addWindowListener(newtDemoListener);
 
         if( useAnimator ) {
             animator.add(glWindow);
@@ -143,7 +139,7 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
 
         final long t0 = System.currentTimeMillis();
         long t1 = t0;
-        while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+        while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
             Thread.sleep(100);
             t1 = System.currentTimeMillis();
         }
index e8e3741..976025c 100644 (file)
@@ -110,15 +110,15 @@ public class TestRedSquareES2NEWT extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
                             glWindow.setFullscreen(!glWindow.isFullscreen());
-                    } }.start();
+                    } } );
                 } else if(e.getKeyChar()=='d') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
                             glWindow.setUndecorated(!glWindow.isUndecorated());
-                    } }.start();
+                    } } );
                 }
             }
         });
index 17e50ad..3422aa0 100644 (file)
@@ -29,8 +29,8 @@
 package com.jogamp.opengl.test.junit.jogl.demos.gl2.newt;
 
 import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
 import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
 import com.jogamp.opengl.test.junit.util.QuitAdapter;
 
 import com.jogamp.opengl.util.Animator;
index aec728c..eec31b0 100644 (file)
@@ -198,14 +198,14 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
                             final Thread t = glWindow.setExclusiveContextThread(null);
                             System.err.println("[set fullscreen  pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
                             glWindow.setFullscreen(!glWindow.isFullscreen());
                             System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
                             glWindow.setExclusiveContextThread(t);
-                    } }.start();
+                    } } );
                 }
             }
         });
index 0578492..fdd6d64 100644 (file)
@@ -205,14 +205,14 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase {
                     return;
                 }
                 if(e.getKeyChar()=='f') {
-                    new Thread() {
+                    glWindow.invokeOnNewThread(null, false, new Runnable() {
                         public void run() {
                             final Thread t = glWindow.setExclusiveContextThread(null);
                             System.err.println("[set fullscreen  pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
                             glWindow.setFullscreen(!glWindow.isFullscreen());
                             System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
                             glWindow.setExclusiveContextThread(t);
-                    } }.start();
+                    } } );
                 }
             }
         });
index 9a422f4..2205348 100644 (file)
@@ -50,7 +50,8 @@ import com.jogamp.opengl.GLCapabilities ;
 import com.jogamp.opengl.GLEventListener ;
 import com.jogamp.opengl.GLProfile;
 import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.common.util.InterruptedRuntimeException;
 import com.jogamp.nativewindow.swt.SWTAccessor;
 import com.jogamp.newt.NewtFactory;
 import com.jogamp.newt.event.KeyAdapter;
@@ -143,14 +144,13 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
 
     ////////////////////////////////////////////////////////////////////////////////
 
-    static class ResizeThread extends Thread {
+    static class ResizeThread extends InterruptSource.Thread {
         volatile boolean shallStop = false;
         private final Shell _shell ;
         private int _n ;
 
         public ResizeThread( final Shell shell )
         {
-            super();
             _shell = shell ;
         }
 
@@ -196,9 +196,9 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
                     display.asyncExec( resizeAction );
                     display.wake();
 
-                    Thread.sleep( 50L ) ;
+                    java.lang.Thread.sleep( 50L ) ;
                 } catch( final InterruptedException e ) {
-                    break ;
+                    throw new InterruptedRuntimeException(e);
                 }
             }
             System.err.println("*R-Exit* shallStop "+shallStop+", disposed "+_shell.isDisposed());
@@ -207,7 +207,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
 
     ////////////////////////////////////////////////////////////////////////////////
 
-    static class KeyfireThread extends Thread
+    static class KeyfireThread extends InterruptSource.Thread
     {
         volatile boolean shallStop = false;
         Display _display;
@@ -216,6 +216,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
 
         public KeyfireThread(final Robot robot, final Display display)
         {
+            super();
             _robot = robot;
             _display = display;
         }
@@ -231,7 +232,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
                     AWTRobotUtil.waitForIdle(_robot);
                     AWTRobotUtil.newtKeyPress(_n, _robot, true, KeyEvent.VK_0, 10);
                     AWTRobotUtil.newtKeyPress(_n, _robot, false, KeyEvent.VK_0, 0);
-                    Thread.sleep( 40L ) ;
+                    java.lang.Thread.sleep( 40L ) ;
                     _n++;
                     if(!_display.isDisposed()) {
                         _display.wake();
@@ -368,7 +369,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
         }
 
         {
-            final Thread t = new Thread(new Runnable() {
+            final Thread t = new InterruptSource.Thread(null, new Runnable() {
                 @Override
                 public void run() {
                     try {
index 7072ed9..9b2e46d 100644 (file)
@@ -51,6 +51,7 @@ import com.jogamp.opengl.GLProfile;
 import jogamp.newt.swt.SWTEDTUtil;
 import jogamp.newt.swt.event.SWTNewtEventFactory;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.nativewindow.swt.SWTAccessor;
 import com.jogamp.newt.NewtFactory;
 import com.jogamp.newt.opengl.GLWindow ;
@@ -110,7 +111,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
 
     ////////////////////////////////////////////////////////////////////////////////
 
-    static class AsyncExecEDTFeederThread extends Thread {
+    static class AsyncExecEDTFeederThread extends InterruptSource.Thread {
         volatile boolean shallStop = false;
         private final Display swtDisplay ;
         private final jogamp.newt.DisplayImpl newtDisplay;
@@ -118,7 +119,6 @@ public class TestSWTBug643AsyncExec extends UITestCase {
 
         public AsyncExecEDTFeederThread( final Display swtDisplay, final com.jogamp.newt.Display newtDisplay )
         {
-            super();
             this.swtDisplay = swtDisplay ;
             this.newtDisplay = (jogamp.newt.DisplayImpl)newtDisplay;
         }
@@ -152,7 +152,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
                         // only perform async exec on valid and already running NEWT EDT!
                         newtDisplay.runOnEDTIfAvail(false, newtAsyncAction);
                     }
-                    Thread.sleep( 50L ) ;
+                    java.lang.Thread.sleep( 50L ) ;
                 } catch( final InterruptedException e ) {
                     break ;
                 }
@@ -275,7 +275,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
         }
 
         {
-            final Thread t = new Thread(new Runnable() {
+            final Thread t = new InterruptSource.Thread(null, new Runnable() {
                 @Override
                 public void run() {
                     try {
index 8339831..7fc14a6 100644 (file)
@@ -28,6 +28,7 @@
 
 package com.jogamp.opengl.test.junit.jogl.util.texture;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.opengl.GLWindow;
 
 import com.jogamp.opengl.GLAutoDrawable;
@@ -99,7 +100,7 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase {
                     c=0;
                     snapshot(i++, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
                     dw_old = dw;
-                    new Thread() {
+                    new InterruptSource.Thread() {
                         @Override
                         public void run() {
                             glWindow.setSize(2*dw, 2*dh);
index 2f1f7d7..186c3a7 100644 (file)
@@ -36,6 +36,8 @@ import org.junit.Test;
 import org.junit.runners.MethodSorters;
 
 import com.jogamp.common.ExceptionUtils;
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.common.util.SourcedInterruptedException;
 import com.jogamp.common.util.VersionUtil;
 import com.jogamp.junit.util.SingletonJunitCase;
 import com.jogamp.newt.opengl.GLWindow;
@@ -85,49 +87,35 @@ public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
         }
     }
 
-    @SuppressWarnings("serial")
-    static class MyInterruptedException extends InterruptedException {
-        public MyInterruptedException(final String message, final Throwable cause) {
-            super(message);
-            if( null != cause ) {
-                initCause(cause);
-            }
-        }
-    }
-    static class MyThread extends Thread implements Thread.UncaughtExceptionHandler {
-        volatile Throwable interruptCause = null;
-        volatile int interruptCounter = 0;
+    static class MyThread extends InterruptSource.Thread implements Thread.UncaughtExceptionHandler {
         volatile boolean myThreadStarted = false;
         volatile boolean myThreadStopped = false;
 
         public MyThread(final Runnable target, final String name) {
-            super(target, name);
+            super(null, target, name);
             setUncaughtExceptionHandler(this);
         }
-        public synchronized void clearInterruptCounter() {
-            interruptCounter = 0;
-            interruptCause = null;
-        }
-        public synchronized boolean interruptCalled() { return 0 < interruptCounter; }
 
         public static void testInterrupted1() throws InterruptedException {
-            if( Thread.interrupted() ) {
-                throw new InterruptedException(Thread.currentThread().getName()+".testInterrupted -> TRUE (silent interruption)");
+            if( java.lang.Thread.interrupted() ) {
+                throw SourcedInterruptedException.wrap(
+                        new InterruptedException(java.lang.Thread.currentThread().getName()+".testInterrupted -> TRUE (silent interruption)"));
             }
         }
         public synchronized void testInterrupted(final boolean ignore) throws InterruptedException {
             if( isInterrupted() ) {
                 final boolean current;
-                if( this == Thread.currentThread() ) {
-                    Thread.interrupted(); // clear!
+                if( this == java.lang.Thread.currentThread() ) {
+                    java.lang.Thread.interrupted(); // clear!
                     current = true;
                 } else {
                     current = false;
                 }
-                final InterruptedException e = new MyInterruptedException(getName()+".testInterrupted -> TRUE (current "+current+", counter "+interruptCounter+")",
-                                                                          interruptCause);
-                interruptCause = null;
-                interruptCounter = 0;
+                final int counter = getInterruptCounter(false);
+                final Throwable source = getInterruptSource(true);
+                final InterruptedException e = new SourcedInterruptedException(
+                                                getName()+".testInterrupted -> TRUE (current "+current+", counter "+counter+")",
+                                                null, source);
                 if( !ignore ) {
                     throw e;
                 } else {
@@ -145,16 +133,9 @@ public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
                 myThreadStopped = true;
             }
         }
-        @Override
-        public synchronized void interrupt() {
-            interruptCounter++;
-            interruptCause = new Throwable(getName()+".interrupt() ************************************************* - count "+interruptCounter);
-            ExceptionUtils.dumpThrowable("causing", interruptCause);
-            super.interrupt();
-        }
 
         @Override
-        public void uncaughtException(final Thread t, final Throwable e) {
+        public void uncaughtException(final java.lang.Thread t, final Throwable e) {
             System.err.println("UncaughtException on Thread "+t.getName()+": "+e.getMessage());
             ExceptionUtils.dumpThrowable("UncaughtException", e);
         }
@@ -200,7 +181,7 @@ public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
                 }
                 System.err.println("test00.resize["+i+"]: "+ow+"x"+oh+" -> "+nw+"x"+nh);
                 window1.setSize(nw, nh);
-                ok = !t.interruptCalled() && !t.isInterrupted() && edt.isRunning() && anim.isAnimating();
+                ok = 0==t.getInterruptCounter(false) && !t.isInterrupted() && edt.isRunning() && anim.isAnimating();
                 t.testInterrupted(false);
             }
         } catch (final InterruptedException e) {
@@ -215,7 +196,7 @@ public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
             ExceptionUtils.dumpThrowable("InterruptedException-2", e);
             interrupt2 = true;
         }
-        Assert.assertFalse("interruptCalled()", t.interruptCalled());
+        Assert.assertEquals("interruptCounter not zero", 0, t.getInterruptCounter(false));
         Assert.assertFalse("interrupt() occured!", t.isInterrupted());
         Assert.assertFalse("Interrupt-1 occured!", interrupt1);
         Assert.assertFalse("Interrupt-2 occured!", interrupt2);
@@ -256,7 +237,7 @@ public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
             ExceptionUtils.dumpThrowable("InterruptedException-2", e);
             interrupt2 = true;
         }
-        Assert.assertFalse("interruptCalled()", t.interruptCalled());
+        Assert.assertEquals("interruptCounter not zero", 0, t.getInterruptCounter(false));
         Assert.assertFalse("interrupt() occured!", t.isInterrupted());
         Assert.assertFalse("Interrupt-1 occured!", interrupt1);
         Assert.assertFalse("Interrupt-2 occured!", interrupt2);
@@ -279,7 +260,7 @@ public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
                     interruptInit0 = true;
                     test = null;
                 }
-                t.clearInterruptCounter();
+                t.clearInterruptSource();
                 if( null != test ) {
                     test.initTest();
                     test.subTest00();
index 39c6c9f..5f88d1c 100644 (file)
@@ -40,6 +40,7 @@ import org.junit.FixMethodOrder;
 import org.junit.Test ;
 import org.junit.runners.MethodSorters;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.common.util.RunnableTask;
 import com.jogamp.newt.event.MouseEvent;
 import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
@@ -344,20 +345,17 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
         }
         _testMouseListener.setModifierCheckEnabled( true ) ;
 
-        Throwable throwable = null;
         // final Object sync = new Object();
         final RunnableTask rt = new RunnableTask( testAction, null, true, System.err );
         try {
             // synchronized(sync) {
-                new Thread(rt, "Test-Thread").start();
+                new InterruptSource.Thread(null, rt, "Test-Thread").start();
                 int i=0;
-                while( !rt.isExecuted() && null == throwable ) {
+                while( rt.isInQueue() ) {
                     System.err.println("WAIT-till-done: eventDispatch() #"+i++);
                     eventDispatch();
                 }
-                if(null==throwable) {
-                    throwable = rt.getThrowable();
-                }
+                final Throwable throwable = rt.getThrowable();
                 if(null!=throwable) {
                     throw new RuntimeException(throwable);
                 }
index cade054..b9be0ad 100644 (file)
@@ -154,7 +154,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
         final GLEventListener demo1 = new GearsES2(1);
         setDemoFields(demo1, glWindow1, false);
         glWindow1.addGLEventListener(demo1);
-        glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
+        glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
         glWindow1.addKeyListener(new KeyAdapter() {
             public void keyReleased(final KeyEvent e) {
                 if( !e.isPrintableKey() || e.isAutoRepeat() ) {
index ae873ea..3bf13f0 100644 (file)
@@ -29,21 +29,21 @@ package com.jogamp.opengl.test.junit.newt.parenting;
 
 import java.awt.Frame;
 
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.nativewindow.CapabilitiesImmutable;
 import com.jogamp.nativewindow.util.InsetsImmutable;
 import com.jogamp.newt.Window;
 import com.jogamp.newt.awt.NewtCanvasAWT;
 import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
 
 public class NewtAWTReparentingKeyAdapter extends NEWTDemoListener {
     final Frame frame;
     final NewtCanvasAWT newtCanvasAWT;
 
-    public NewtAWTReparentingKeyAdapter(final Frame frame, final NewtCanvasAWT newtCanvasAWT, final GLWindow glWindow, final QuitAdapter quitAdapter) {
-        super(glWindow, quitAdapter, null);
+    public NewtAWTReparentingKeyAdapter(final Frame frame, final NewtCanvasAWT newtCanvasAWT, final GLWindow glWindow) {
+        super(glWindow, null);
         this.frame = frame;
         this.newtCanvasAWT = newtCanvasAWT;
     }
@@ -64,9 +64,9 @@ public class NewtAWTReparentingKeyAdapter extends NEWTDemoListener {
             case KeyEvent.VK_R:
                 e.setConsumed(true);
                 quitAdapterOff();
-                new Thread() {
+                new InterruptSource.Thread() {
                     public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
+                        final java.lang.Thread t = glWindow.setExclusiveContextThread(null);
                         if(glWindow.getParent()==null) {
                             printlnState("[reparent pre - glWin to HOME]");
                             glWindow.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */);
index b53da38..4af752e 100644 (file)
@@ -47,6 +47,7 @@ import javax.swing.WindowConstants;
 import com.jogamp.opengl.*;
 
 import com.jogamp.opengl.util.Animator;
+import com.jogamp.common.util.InterruptSource;
 import com.jogamp.newt.*;
 import com.jogamp.newt.opengl.*;
 import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -140,7 +141,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
         animator1.start();
 
         final GLDisturbanceAction disturbanceAction = new GLDisturbanceAction(glWindow1);
-        new Thread(disturbanceAction).start();
+        new InterruptSource.Thread(null, disturbanceAction).start();
         disturbanceAction.waitUntilRunning();
 
         final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
@@ -274,7 +275,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
         animator1.start();
 
         final GLDisturbanceAction disturbanceAction = new GLDisturbanceAction(glWindow1);
-        new Thread(disturbanceAction).start();
+        new InterruptSource.Thread(null, disturbanceAction).start();
         disturbanceAction.waitUntilRunning();
 
         final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
index 723b840..73d41ae 100644 (file)
@@ -88,7 +88,7 @@ public class TestParenting03AWT extends UITestCase {
         final GLEventListener demo1 = new GearsES2(1);
         setDemoFields(demo1, glWindow1, false);
         glWindow1.addGLEventListener(demo1);
-        glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
+        glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
         final GLAnimatorControl animator1 = new Animator(glWindow1);
         animator1.start();
 
@@ -104,7 +104,7 @@ public class TestParenting03AWT extends UITestCase {
             final GLEventListener demo2 = new GearsES2(1);
             setDemoFields(demo2, glWindow2, false);
             glWindow2.addGLEventListener(demo2);
-            glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2, null));
+            glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2));
             animator2 = new Animator(glWindow2);
             animator2.start();
         }
index 60f2f96..bf656bb 100644 (file)
@@ -42,6 +42,7 @@ import java.util.List;
 import com.jogamp.opengl.GLContext;
 
 import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
 
 public class MiscUtils {
     public static boolean atob(final String str, final boolean def) {
@@ -160,7 +161,7 @@ public class MiscUtils {
         return false;
     }
 
-    public static class StreamDump extends Thread {
+    public static class StreamDump extends InterruptSource.Thread {
         final InputStream is;
         final StringBuilder outString;
         final OutputStream outStream;
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java
deleted file mode 100644 (file)
index 3e0b7c7..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-/**
- * Copyright 2015 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- *    1. Redistributions of source code must retain the above copyright notice, this list of
- *       conditions and the following disclaimer.
- *
- *    2. Redistributions in binary form must reproduce the above copyright notice, this list
- *       of conditions and the following disclaimer in the documentation and/or other materials
- *       provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-package com.jogamp.opengl.test.junit.util;
-
-import java.net.URLConnection;
-
-import com.jogamp.common.util.IOUtil;
-import com.jogamp.nativewindow.CapabilitiesImmutable;
-import com.jogamp.nativewindow.ScalableSurface;
-import com.jogamp.newt.Display;
-import com.jogamp.newt.Display.PointerIcon;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.KeyListener;
-import com.jogamp.newt.event.MouseAdapter;
-import com.jogamp.newt.event.MouseEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.FPSCounter;
-import com.jogamp.opengl.GL;
-import com.jogamp.opengl.GLAnimatorControl;
-import com.jogamp.opengl.GLAutoDrawable;
-import com.jogamp.opengl.GLRunnable;
-import com.jogamp.opengl.util.Gamma;
-import com.jogamp.opengl.util.PNGPixelRect;
-
-import jogamp.newt.driver.PNGIcon;
-
-public class NEWTDemoListener extends MouseAdapter implements KeyListener {
-    protected final GLWindow glWindow;
-    protected final QuitAdapter quitAdapter;
-    final PointerIcon[] pointerIcons;
-    int pointerIconIdx = 0;
-    float gamma = 1f;
-    float brightness = 0f;
-    float contrast = 1f;
-    boolean confinedFixedCenter = false;
-
-    public NEWTDemoListener(final GLWindow glWin, final QuitAdapter quitAdapter, final PointerIcon[] pointerIcons) {
-        this.glWindow = glWin;
-        this.quitAdapter = quitAdapter;
-        if( null != pointerIcons ) {
-            this.pointerIcons = pointerIcons;
-        } else {
-            this.pointerIcons = createPointerIcons(glWindow);
-        }
-    }
-    public NEWTDemoListener(final GLWindow glWin, final PointerIcon[] pointerIcons) {
-        this(glWin, null, pointerIcons);
-    }
-    public NEWTDemoListener(final GLWindow glWin) {
-        this(glWin, null, null);
-    }
-
-    protected void printlnState(final String prelude) {
-        System.err.println(prelude+": "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()+", state "+glWindow.getStateMaskString());
-    }
-    protected void printlnState(final String prelude, final String post) {
-        System.err.println(prelude+": "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()+", state "+glWindow.getStateMaskString()+", "+post);
-    }
-    protected void quitAdapterOff() {
-        if( null != quitAdapter ) {
-            quitAdapter.enable(false);
-        }
-    }
-    protected void quitAdapterOn() {
-        if( null != quitAdapter ) {
-            quitAdapter.clear();
-            quitAdapter.enable(true);
-        }
-    }
-
-    @Override
-    public void keyPressed(final KeyEvent e) {
-        if( e.isAutoRepeat() || e.isConsumed() ) {
-            return;
-        }
-        final int keySymbol = e.getKeySymbol();
-        switch(keySymbol) {
-            case KeyEvent.VK_SPACE:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        if(glWindow.getAnimator().isPaused()) {
-                            glWindow.getAnimator().resume();
-                        } else {
-                            glWindow.getAnimator().pause();
-                        }
-                    }
-                }.run();
-                break;
-            case KeyEvent.VK_A:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set alwaysontop pre]");
-                        glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop());
-                        printlnState("[set alwaysontop post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_B:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set alwaysonbottom pre]");
-                        glWindow.setAlwaysOnBottom(!glWindow.isAlwaysOnBottom());
-                        printlnState("[set alwaysonbottom post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_C:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        if( null != pointerIcons ) {
-                            final Thread t = glWindow.setExclusiveContextThread(null);
-                            printlnState("[set pointer-icon pre]");
-                            final PointerIcon currentPI = glWindow.getPointerIcon();
-                            final PointerIcon newPI;
-                            if( pointerIconIdx >= pointerIcons.length ) {
-                                newPI=null;
-                                pointerIconIdx=0;
-                            } else {
-                                newPI=pointerIcons[pointerIconIdx++];
-                            }
-                            glWindow.setPointerIcon( newPI );
-                            printlnState("[set pointer-icon post]", currentPI+" -> "+glWindow.getPointerIcon());
-                            glWindow.setExclusiveContextThread(t);
-                        }
-                } }.start();
-                break;
-            case KeyEvent.VK_D:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        // while( null != glWindow.getExclusiveContextThread() ) ;
-                        printlnState("[set undecorated pre]");
-                        glWindow.setUndecorated(!glWindow.isUndecorated());
-                        printlnState("[set undecorated post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_F:
-                e.setConsumed(true);
-                quitAdapterOff();
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set fullscreen pre]");
-                        if( glWindow.isFullscreen() ) {
-                            glWindow.setFullscreen( false );
-                        } else {
-                            if( e.isAltDown() ) {
-                                glWindow.setFullscreen( null );
-                            } else {
-                                glWindow.setFullscreen( true );
-                            }
-                        }
-                        printlnState("[set fullscreen post]");
-                        glWindow.setExclusiveContextThread(t);
-                        quitAdapterOn();
-                } }.start();
-                break;
-            case KeyEvent.VK_G:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final float newGamma = gamma + ( e.isShiftDown() ? -0.1f : 0.1f );
-                        System.err.println("[set gamma]: "+gamma+" -> "+newGamma);
-                        if( Gamma.setDisplayGamma(glWindow, newGamma, brightness, contrast) ) {
-                            gamma = newGamma;
-                        }
-                } }.start();
-                break;
-            case KeyEvent.VK_I:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set pointer-visible pre]");
-                        glWindow.setPointerVisible(!glWindow.isPointerVisible());
-                        printlnState("[set pointer-visible post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_J:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set pointer-confined pre]", "warp-center: "+e.isShiftDown());
-                        final boolean confine = !glWindow.isPointerConfined();
-                        glWindow.confinePointer(confine);
-                        printlnState("[set pointer-confined post]", "warp-center: "+e.isShiftDown());
-                        if( e.isShiftDown() ) {
-                            setConfinedFixedCenter(confine);
-                        } else if( !confine ) {
-                            setConfinedFixedCenter(false);
-                        }
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_M:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        // none:  max-v
-                        // alt:   max-h
-                        // shift: max-hv
-                        // ctrl:  max-off
-                        final boolean horz, vert;
-                        if( e.isControlDown() ) {
-                            horz = false;
-                            vert = false;
-                        } else if( e.isShiftDown() ) {
-                            final boolean bothMax = glWindow.isMaximizedHorz() && glWindow.isMaximizedVert();
-                            horz = !bothMax;
-                            vert = !bothMax;
-                        } else if( !e.isAltDown() ) {
-                            horz = glWindow.isMaximizedHorz();
-                            vert = !glWindow.isMaximizedVert();
-                        } else if( e.isAltDown() ) {
-                            horz = !glWindow.isMaximizedHorz();
-                            vert = glWindow.isMaximizedVert();
-                        } else {
-                            vert = glWindow.isMaximizedVert();
-                            horz = glWindow.isMaximizedHorz();
-                        }
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set maximize pre]", "max[vert "+vert+", horz "+horz+"]");
-                        glWindow.setMaximized(horz, vert);
-                        printlnState("[set maximize post]", "max[vert "+vert+", horz "+horz+"]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_P:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set position pre]");
-                        glWindow.setPosition(100, 100);
-                        printlnState("[set position post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_R:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set resizable pre]");
-                        glWindow.setResizable(!glWindow.isResizable());
-                        printlnState("[set resizable post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_S:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set sticky pre]");
-                        glWindow.setSticky(!glWindow.isSticky());
-                        printlnState("[set sticky post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_V:
-                e.setConsumed(true);
-                if( e.isControlDown() ) {
-                    glWindow.invoke(false, new GLRunnable() {
-                        @Override
-                        public boolean run(final GLAutoDrawable drawable) {
-                            final GL gl = drawable.getGL();
-                            final int _i = gl.getSwapInterval();
-                            final int i;
-                            switch(_i) {
-                                case  0: i = -1; break;
-                                case -1: i =  1; break;
-                                case  1: i =  0; break;
-                                default: i =  1; break;
-                            }
-                            gl.setSwapInterval(i);
-
-                            final GLAnimatorControl a = drawable.getAnimator();
-                            if( null != a ) {
-                                a.resetFPSCounter();
-                            }
-                            if(drawable instanceof FPSCounter) {
-                                ((FPSCounter)drawable).resetFPSCounter();
-                            }
-                            System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval());
-                            return true;
-                        }
-                    });
-                } else {
-                    new Thread() {
-                        public void run() {
-                            final boolean wasVisible = glWindow.isVisible();
-                            {
-                                final Thread t = glWindow.setExclusiveContextThread(null);
-                                printlnState("[set visible pre]");
-                                glWindow.setVisible(!wasVisible);
-                                printlnState("[set visible post]");
-                                glWindow.setExclusiveContextThread(t);
-                            }
-                            if( wasVisible && !e.isControlDown() ) {
-                                try {
-                                    Thread.sleep(5000);
-                                } catch (final InterruptedException e) {
-                                    e.printStackTrace();
-                                }
-                                final Thread t = glWindow.setExclusiveContextThread(null);
-                                printlnState("[reset visible pre]");
-                                glWindow.setVisible(true);
-                                printlnState("[reset visible post]");
-                                glWindow.setExclusiveContextThread(t);
-                            }
-                    } }.start();
-                }
-                break;
-            case KeyEvent.VK_W:
-                e.setConsumed(true);
-                new Thread() {
-                    public void run() {
-                        final Thread t = glWindow.setExclusiveContextThread(null);
-                        printlnState("[set pointer-pos pre]");
-                        glWindow.warpPointer(glWindow.getSurfaceWidth()/2, glWindow.getSurfaceHeight()/2);
-                        printlnState("[set pointer-pos post]");
-                        glWindow.setExclusiveContextThread(t);
-                } }.start();
-                break;
-            case KeyEvent.VK_X:
-                e.setConsumed(true);
-                final float[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new float[2]);
-                final float[] reqSurfacePixelScale;
-                if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) {
-                    reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
-                } else {
-                    reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
-                }
-                System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]);
-                glWindow.setSurfaceScale(reqSurfacePixelScale);
-                final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]);
-                final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]);
-                System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+
-                        reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
-                        valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
-                        hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
-                setTitle();
-        }
-    }
-    @Override
-    public void keyReleased(final KeyEvent e) { }
-
-    public void setConfinedFixedCenter(final boolean v) {
-        confinedFixedCenter = v;
-    }
-    @Override
-    public void mouseMoved(final MouseEvent e) {
-        if( e.isConfined() ) {
-            mouseCenterWarp(e);
-        }
-    }
-    @Override
-    public void mouseDragged(final MouseEvent e) {
-        if( e.isConfined() ) {
-            mouseCenterWarp(e);
-        }
-    }
-    @Override
-    public void mouseClicked(final MouseEvent e) {
-        if(e.getClickCount() == 2 && e.getPointerCount() == 1) {
-            glWindow.setFullscreen(!glWindow.isFullscreen());
-            System.err.println("setFullscreen: "+glWindow.isFullscreen());
-        }
-    }
-    private void mouseCenterWarp(final MouseEvent e) {
-        if(e.isConfined() && confinedFixedCenter ) {
-            final int x=glWindow.getSurfaceWidth()/2;
-            final int y=glWindow.getSurfaceHeight()/2;
-            glWindow.warpPointer(x, y);
-        }
-    }
-
-    public void setTitle() {
-        setTitle(glWindow);
-    }
-    public static void setTitle(final GLWindow win) {
-        final CapabilitiesImmutable chosenCaps = win.getChosenCapabilities();
-        final CapabilitiesImmutable reqCaps = win.getRequestedCapabilities();
-        final CapabilitiesImmutable caps = null != chosenCaps ? chosenCaps : reqCaps;
-        final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
-        final float[] sDPI = win.getPixelsPerMM(new float[2]);
-        sDPI[0] *= 25.4f;
-        sDPI[1] *= 25.4f;
-        win.setTitle("GLWindow["+capsA+"], win: "+win.getBounds()+", pix: "+win.getSurfaceWidth()+"x"+win.getSurfaceHeight()+", sDPI "+sDPI[0]+" x "+sDPI[1]);
-    }
-
-    public static PointerIcon[] createPointerIcons(final GLWindow glWindow) {
-        final PointerIcon[] pointerIcons = { null, null, null, null, null };
-        {
-            final Display disp = glWindow.getScreen().getDisplay();
-            disp.createNative();
-            int idx = 0;
-            {
-                PointerIcon _pointerIcon = null;
-                final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/cross-grey-alpha-16x16.png" } );
-                try {
-                    _pointerIcon = disp.createPointerIcon(res, 8, 8);
-                    System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
-                } catch (final Exception e) {
-                    e.printStackTrace();
-                }
-                pointerIcons[idx] = _pointerIcon;
-            }
-            idx++;
-            {
-                PointerIcon _pointerIcon = null;
-                final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/pointer-grey-alpha-16x24.png" } );
-                try {
-                    _pointerIcon = disp.createPointerIcon(res, 0, 0);
-                    System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
-                } catch (final Exception e) {
-                    e.printStackTrace();
-                }
-                pointerIcons[idx] = _pointerIcon;
-            }
-            idx++;
-            {
-                PointerIcon _pointerIcon = null;
-                final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-red-alpha-64x64.png" } );
-                try {
-                    _pointerIcon = disp.createPointerIcon(res, 0, 0);
-                    System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
-                } catch (final Exception e) {
-                    e.printStackTrace();
-                }
-                pointerIcons[idx] = _pointerIcon;
-            }
-            idx++;
-            {
-                PointerIcon _pointerIcon = null;
-                final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-blue-alpha-64x64.png" } );
-                try {
-                    _pointerIcon = disp.createPointerIcon(res, 0, 0);
-                    System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
-                } catch (final Exception e) {
-                    e.printStackTrace();
-                }
-                pointerIcons[idx] = _pointerIcon;
-            }
-            idx++;
-            if( PNGIcon.isAvailable() ) {
-                PointerIcon _pointerIcon = null;
-                final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "jogamp-pointer-64x64.png" } );
-                try {
-                    final URLConnection urlConn = res.resolve(0);
-                    final PNGPixelRect image = PNGPixelRect.read(urlConn.getInputStream(), null, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */);
-                    System.err.printf("Create PointerIcon #%02d: %s%n", idx, image.toString());
-                    _pointerIcon = disp.createPointerIcon(image, 32, 0);
-                    System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
-                } catch (final Exception e) {
-                    e.printStackTrace();
-                }
-                pointerIcons[idx] = _pointerIcon;
-            }
-            idx++;
-        }
-        return pointerIcons;
-    }
-
-}
\ No newline at end of file
http://JogAmp.org git info: FAQ, tutorial and man pages.