diff options
author | Sven Gothel <[email protected]> | 2015-09-26 03:50:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-09-26 03:50:09 +0200 |
commit | fbf14fd09bcc8eccaf819e953a82b3619e6de796 (patch) | |
tree | 71a17e063f3ae225983824d7c2af6d329f81ab79 /src/test | |
parent | fa3c55b8176b284752ed14a5a24f7fee36e588a3 (diff) |
Bug 1223 OSX: GLWindow loses focus after maximizing - Analysis
TestGearsES2NEWT reacts on key-press 'n', opening another GLWindow.
Procedure:
[1] Pressing 'n' (2nd GLWindow) and manual re-focus 1st GLWindow
[2] Pressing 'm' (single, alt, shift) on 1st GLWindow maximizes it
Focus is still on 1st GLWindow!
[3] Pressing ctrl-m un-maximizes ..
Focus is still on 1st GLWindow!
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java | 32 |
1 files changed, 32 insertions, 0 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 4e318048d..6fb7bab46 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.Window; import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.event.KeyAdapter; +import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.newt.opengl.util.NEWTDemoListener; @@ -189,11 +191,37 @@ public class TestGearsES2NEWT extends UITestCase { } }); + final GLWindow[] glWindow2 = { null }; + final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow); newtDemoListener.quitAdapterEnable(true); glWindow.addKeyListener(newtDemoListener); glWindow.addMouseListener(newtDemoListener); glWindow.addWindowListener(newtDemoListener); + glWindow.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent e) { + if( e.isAutoRepeat() ) { + return; + } + if(e.getKeyChar()=='n') { + if( null != glWindow2[0] && glWindow2[0].isNativeValid() ) { + glWindow2[0].destroy(); + glWindow2[0] = null; + } else { + glWindow2[0] = GLWindow.create(screen, caps); + glWindow2[0].setTitle("GLWindow2"); + glWindow2[0].setPosition(glWindow.getX()+glWindow.getWidth()+64, glWindow.getY()); + glWindow2[0].setSize(glWindow.getWidth(), glWindow.getHeight()); + glWindow2[0].addGLEventListener(new LineSquareXDemoES2(false)); + final Animator animator2 = useAnimator ? new Animator(glWindow2[0]) : null; + if( null != animator2 ) { + animator2.start(); + } + glWindow2[0].setVisible(true); + } + } + } } ); if( useAnimator ) { animator.add(glWindow); @@ -310,6 +338,10 @@ public class TestGearsES2NEWT extends UITestCase { } Assert.assertEquals(null, glWindow.getExclusiveContextThread()); glWindow.destroy(); + if( null != glWindow2[0] && glWindow2[0].isNativeValid() ) { + glWindow2[0].destroy(); + glWindow2[0] = null; + } if( NativeWindowFactory.isAWTAvailable() ) { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false)); } |