From 06b6a74f4915a539f6025112a82e517d8e8cb7af Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 20 Jul 2012 14:48:52 +0200 Subject: Fix TestFocus01SwingAWTRobot failure duer to RedSquareES2's setFullscreen() toggle mouse adapter :) Moved the fullscreen toggle mouse adapter to main test class. --- .../test/junit/jogl/demos/es2/RedSquareES2.java | 24 +--------------------- .../jogl/demos/es2/newt/TestGearsES2NEWT.java | 8 ++++++++ 2 files changed, 9 insertions(+), 23 deletions(-) (limited to 'src/test/com') 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()); -- cgit v1.2.3