diff options
5 files changed, 22 insertions, 35 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index ee6d44d48..b7f207752 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -198,7 +198,7 @@ public abstract class NativeWindowFactory { ReflectionUtil.isClassAvailable(AWTComponentClassName, cl) && ReflectionUtil.isClassAvailable("javax.media.nativewindow.awt.AWTGraphicsDevice", cl) ) { - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { try { jawtUtilClass = Class.forName(JAWTUtilClassName, false, NativeWindowFactory.class.getClassLoader()); diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index dd8752613..420e9d1fa 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -294,7 +294,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } // always flag visible, // allowing to retry if visible && !isNativeValid() - setVisibleImpl(true, x, y, width, height); + visible = true; } } finally { if(null!=parentWindow) { @@ -693,10 +693,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!isNativeValid() && visible) { if( 0<width*height ) { nativeWindowCreated = createNative(); - if(nativeWindowCreated) { - WindowImpl.this.waitForVisible(visible, true); - madeVisible = visible; - } + madeVisible = nativeWindowCreated; } } else if(WindowImpl.this.visible != visible) { if(isNativeValid()) { diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java index 531b8d2a8..d71015d6c 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java @@ -120,10 +120,9 @@ public class AWTWindow extends WindowImpl { container.setLocation(x, y); new AWTWindowAdapter(this).addTo(container); // fwd all AWT Window events to here - if(null!=frame) { - frame.setUndecorated(isUndecorated()); - } - + reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); + // throws exception if failed .. + setWindowHandle(1); // just a marker .. } @@ -175,11 +174,7 @@ public class AWTWindow extends WindowImpl { insets.setBottomHeight(contInsets.bottom); } - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { - if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { - container.setVisible(0 != ( FLAG_IS_VISIBLE & flags)); - } - + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { if(0 != ( FLAG_CHANGE_DECORATION & flags) && null!=frame) { if(!container.isDisplayable()) { frame.setUndecorated(isUndecorated()); @@ -189,6 +184,11 @@ public class AWTWindow extends WindowImpl { } } } + + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { + container.setVisible(0 != ( FLAG_IS_VISIBLE & flags)); + } + x=(x>=0)?x:AWTWindow.this.x; y=(x>=0)?y:AWTWindow.this.y; width=(width>0)?width:AWTWindow.this.width; @@ -199,14 +199,16 @@ public class AWTWindow extends WindowImpl { container.setSize(width + insets.left + insets.right, height + insets.top + insets.bottom); - if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { - config = canvas.getAWTGraphicsConfiguration(); - - if (config == null) { - throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { + if( 0 != ( FLAG_IS_VISIBLE & flags ) ) { + if( !hasDeviceChanged() ) { + // oops ?? + config = canvas.getAWTGraphicsConfiguration(); + if(null == config) { + throw new NativeWindowException("Error: !hasDeviceChanged && null == GraphicsConfiguration: "+this); + } + } } - - updateDeviceData(); visibleChanged(0 != ( FLAG_IS_VISIBLE & flags)); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java index dd1827102..78f2f4574 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java @@ -58,9 +58,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; public class TestFocus02SwingAWTRobot extends UITestCase { static int width, height; - static long durationPerTest = 800; static long awtWaitTimeout = 1000; - static long waitReparent = 0; static GLCapabilities glCaps; @BeforeClass @@ -161,7 +159,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase { Assert.assertTrue(AWTRobotUtil.toFront(robot, jFrame1)); int wait=0; - while(wait<awtWaitTimeout/100 && glWindow1.getTotalFPSFrames()<1) { Thread.sleep(awtWaitTimeout/10); wait++; } + while(wait<awtWaitTimeout/10 && glWindow1.getTotalFPSFrames()<1) { Thread.sleep(awtWaitTimeout/100); wait++; } System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFPSFrames()); Assert.assertTrue(glWindow1.isVisible()); Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); @@ -285,15 +283,6 @@ public class TestFocus02SwingAWTRobot extends UITestCase { public static void main(String args[]) throws IOException, AWTException, InterruptedException, InvocationTargetException { - for(int i=0; i<args.length; i++) { - if(args[i].equals("-time")) { - durationPerTest = atoi(args[++i]); - } else if(args[i].equals("-wait")) { - waitReparent = atoi(args[++i]); - } - } - System.err.println("durationPerTest "+durationPerTest); - System.err.println("waitReparent "+waitReparent); if(true) { String tstname = TestFocus02SwingAWTRobot.class.getName(); org.junit.runner.JUnitCore.main(tstname); diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java index af3c771f3..661d58bb1 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -39,7 +39,6 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; -import java.awt.event.InputEvent; import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame; |