summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-20 14:48:52 +0200
committerSven Gothel <[email protected]>2012-07-20 14:48:52 +0200
commit06b6a74f4915a539f6025112a82e517d8e8cb7af (patch)
tree9d3fa48f6d8658e98da5fc6097d53f634a06fac2
parent209a5ac217b591991d520789313eb4f819da89d2 (diff)
Fix TestFocus01SwingAWTRobot failure duer to RedSquareES2's setFullscreen() toggle mouse adapter :)
Moved the fullscreen toggle mouse adapter to main test class.
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java24
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java8
3 files changed, 10 insertions, 25 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index e49f91abd..002144b2f 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1805,8 +1805,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public boolean setFullscreen(boolean fullscreen) {
synchronized(fullScreenAction) {
if( fullScreenAction.init(fullscreen) ) {
- if(fullScreenAction.fsOn() &&
- isOffscreenInstance(WindowImpl.this, parentWindow)) {
+ if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
// enable fullscreen on offscreen instance
if(null != parentWindow) {
nfs_parent = parentWindow;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
index 436c44759..a956fe1e4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
@@ -28,8 +28,6 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2;
import com.jogamp.newt.Window;
-import com.jogamp.newt.event.MouseAdapter;
-import com.jogamp.newt.event.MouseEvent;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
@@ -49,7 +47,6 @@ public class RedSquareES2 implements GLEventListener {
GLArrayDataServer colors ;
long t0;
private int swapInterval = 0;
- MyMouseAdapter myMouse = new MyMouseAdapter();
Window window = null;
float aspect = 1.0f;
boolean doRotate = true;
@@ -132,11 +129,6 @@ public class RedSquareES2 implements GLEventListener {
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
st.useProgram(gl, false);
- final Object upstreamWidget = glad.getUpstreamWidget();
- if (!isFBOSlave && upstreamWidget instanceof Window) {
- window = (Window) upstreamWidget;
- window.addMouseListener(myMouse);
- }
t0 = System.currentTimeMillis();
System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
}
@@ -195,25 +187,11 @@ public class RedSquareES2 implements GLEventListener {
}
isInitialized = false;
System.err.println(Thread.currentThread()+" RedSquareES2.dispose ... ");
- if (null != window) {
- window.removeMouseListener(myMouse);
- window = null;
- }
GL2ES2 gl = glad.getGL().getGL2ES2();
st.destroy(gl);
st = null;
pmvMatrix.destroy();
pmvMatrix = null;
System.err.println(Thread.currentThread()+" RedSquareES2.dispose FIN");
- }
-
- class MyMouseAdapter extends MouseAdapter {
- public void mouseClicked(MouseEvent e) {
- System.err.println(e);
- if(null != window && e.getSource() == window) {
- window.setFullscreen(!window.isFullscreen());
- System.err.println("setFullscreen: "+window.isFullscreen());
- }
- }
- }
+ }
}
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 797a16485..fab5bf99b 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
@@ -37,6 +37,8 @@ import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Screen;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.MouseAdapter;
+import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
@@ -220,6 +222,12 @@ public class TestGearsES2NEWT extends UITestCase {
}
}
});
+ glWindow.addMouseListener(new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ glWindow.setFullscreen(!glWindow.isFullscreen());
+ System.err.println("setFullscreen: "+glWindow.isFullscreen());
+ }
+ });
animator.start();
// glWindow.setSkipContextReleaseThread(animator.getThread());