aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java28
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java53
2 files changed, 68 insertions, 13 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index efec961de..8cc676291 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -85,6 +85,7 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean waitForKey = false;
static boolean mouseVisible = true;
static boolean mouseConfined = false;
+ static boolean setPointerIcon = false;
static boolean showFPS = false;
static int loops = 1;
static boolean loop_shutdown = false;
@@ -183,6 +184,10 @@ public class TestGearsES2NEWT extends UITestCase {
}
pointerIconOne = _pointerIconOne;
}
+ if( setPointerIcon ) {
+ glWindow.setPointerIcon(pointerIconOne);
+ System.err.println("Set PointerIcon: "+glWindow.getPointerIcon());
+ }
glWindow.addKeyListener(new KeyAdapter() {
@Override
@@ -216,16 +221,6 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("[set alwaysontop post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setExclusiveContextThread(t);
} }.start();
- } else if(e.getKeyChar()=='c') {
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- System.err.println("[set pointer-icon pre]");
- final PointerIcon currentPI = glWindow.getPointerIcon();
- glWindow.setPointerIcon( currentPI == pointerIconOne ? null : pointerIconOne);
- System.err.println("[set pointer-icon post] "+currentPI+" -> "+glWindow.getPointerIcon());
- glWindow.setExclusiveContextThread(t);
- } }.start();
} else if(e.getKeyChar()=='d') {
new Thread() {
public void run() {
@@ -245,6 +240,16 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("[set position post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
glWindow.setExclusiveContextThread(t);
} }.start();
+ } else if(e.getKeyChar()=='c') {
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set pointer-icon pre]");
+ final PointerIcon currentPI = glWindow.getPointerIcon();
+ glWindow.setPointerIcon( currentPI == pointerIconOne ? null : pointerIconOne);
+ System.err.println("[set pointer-icon post] "+currentPI+" -> "+glWindow.getPointerIcon());
+ glWindow.setExclusiveContextThread(t);
+ } }.start();
} else if(e.getKeyChar()=='i') {
new Thread() {
public void run() {
@@ -482,6 +487,8 @@ public class TestGearsES2NEWT extends UITestCase {
mouseVisible = false;
} else if(args[i].equals("-mouseConfine")) {
mouseConfined = true;
+ } else if(args[i].equals("-pointerIcon")) {
+ setPointerIcon = true;
} else if(args[i].equals("-showFPS")) {
showFPS = true;
} else if(args[i].equals("-width")) {
@@ -537,6 +544,7 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("mouseVisible "+mouseVisible);
System.err.println("mouseConfined "+mouseConfined);
+ System.err.println("pointerIcon "+setPointerIcon);
System.err.println("loops "+loops);
System.err.println("loop shutdown "+loop_shutdown);
System.err.println("forceES2 "+forceES2);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
index 189645d3d..69874df6b 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
@@ -31,6 +31,10 @@ import java.awt.Frame;
import javax.media.nativewindow.util.InsetsImmutable;
+import com.jogamp.common.util.IOUtil;
+import com.jogamp.newt.Display;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.Display.PointerIcon;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -42,6 +46,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final NewtCanvasAWT newtCanvasAWT;
final GLWindow glWindow;
final QuitAdapter quitAdapter;
+ PointerIcon pointerIconTest = null;
public NewtAWTReparentingKeyAdapter(Frame frame, NewtCanvasAWT newtCanvasAWT, GLWindow glWindow, QuitAdapter quitAdapter) {
this.frame = frame;
@@ -54,9 +59,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
}
- if( e.getKeySymbol() == KeyEvent.VK_I ) {
- System.err.println(glWindow);
- } else if( e.getKeySymbol() == KeyEvent.VK_L ) {
+ if( e.getKeySymbol() == KeyEvent.VK_L ) {
javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null);
javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
System.err.println("NewtCanvasAWT position: "+p0+", "+p1);
@@ -140,6 +143,50 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
quitAdapter.enable(true);
}
} }.start();
+ } else if(e.getKeySymbol() == KeyEvent.VK_C ) {
+ if( null == pointerIconTest ) {
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/jogamp-32x32.png" } );
+ final Display disp = glWindow.getScreen().getDisplay();
+ try {
+ pointerIconTest = disp.createPointerIcon(res, 16, 0);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set pointer-icon pre]");
+ final PointerIcon currentPI = glWindow.getPointerIcon();
+ glWindow.setPointerIcon( currentPI == pointerIconTest ? null : pointerIconTest);
+ System.err.println("[set pointer-icon post] "+currentPI+" -> "+glWindow.getPointerIcon());
+ glWindow.setExclusiveContextThread(t);
+ } }.start();
+ } else if( e.getKeySymbol() == KeyEvent.VK_I ) {
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set mouse visible pre]: "+glWindow.isPointerVisible());
+ glWindow.setPointerVisible(!glWindow.isPointerVisible());
+ System.err.println("[set mouse visible post]: "+glWindow.isPointerVisible());
+ glWindow.setExclusiveContextThread(t);
+ } }.start();
+ } else if(e.getKeySymbol() == KeyEvent.VK_J ) {
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set mouse confined pre]: "+glWindow.isPointerConfined());
+ glWindow.confinePointer(!glWindow.isPointerConfined());
+ System.err.println("[set mouse confined post]: "+glWindow.isPointerConfined());
+ glWindow.setExclusiveContextThread(t);
+ } }.start();
+ } else if(e.getKeySymbol() == KeyEvent.VK_W ) {
+ new Thread() {
+ public void run() {
+ System.err.println("[set mouse pos pre]");
+ glWindow.warpPointer(glWindow.getWidth()/2, glWindow.getHeight()/2);
+ System.err.println("[set mouse pos post]");
+ } }.start();
}
}
} \ No newline at end of file