diff options
author | Sven Gothel <[email protected]> | 2014-01-12 07:56:54 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-12 07:56:54 +0100 |
commit | d2f50f2ed523aa8443f647e46aeecc09fa27583d (patch) | |
tree | d37992bafe523630179e6a766c3b60f467659aef | |
parent | 071bdd6ce9f8c41ccecdbf8bc74f276ccd7ff651 (diff) |
AWTParentWindowAdapter/AWTRobotUtil: Use 'isShowing()' instead of 'isVisible()' determining actual on-screen showing state
See commit 071bdd6ce9f8c41ccecdbf8bc74f276ccd7ff651
-rw-r--r-- | src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java | 20 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index e152d96d5..770502326 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java @@ -121,13 +121,14 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt newtChild.runOnEDTIfAvail(false, new Runnable() { @Override public void run() { - int cw = comp.getWidth(); - int ch = comp.getHeight(); + final int cw = comp.getWidth(); + final int ch = comp.getHeight(); if( 0 < cw && 0 < ch ) { if( newtChild.getWidth() != cw || newtChild.getHeight() != ch ) { newtChild.setSize(cw, ch); - if(comp.isVisible() != newtChild.isVisible()) { - newtChild.setVisible(comp.isVisible()); + final boolean v = comp.isShowing(); // compute showing-state throughout hierarchy + if(v != newtChild.isVisible()) { + newtChild.setVisible(v); } } } else if(newtChild.isVisible()) { @@ -164,12 +165,12 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt if( !isSetup ) { return; } final Window newtChild = getNewtWindow(); if( null != newtChild && null == getNewtEventListener() ) { - long bits = e.getChangeFlags(); - final java.awt.Component changed = e.getChanged(); + final long bits = e.getChangeFlags(); + final java.awt.Component comp = e.getComponent(); if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) { - final boolean showing = changed.isShowing(); + final boolean showing = comp.isShowing(); // compute showing-state throughout hierarchy if(DEBUG_IMPLEMENTATION) { - System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", "+changed+", source "+e.getComponent()); + System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", comp "+comp+", changed "+e.getChanged()); } newtChild.runOnEDTIfAvail(false, new Runnable() { @Override @@ -181,8 +182,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt } if(DEBUG_IMPLEMENTATION) { if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) { - final boolean displayability = changed.isDisplayable(); - System.err.println("AWT: hierarchyChanged DISPLAYABILITY_CHANGED: displayability "+displayability+", "+changed); + System.err.println("AWT: hierarchyChanged DISPLAYABILITY_CHANGED: "+e.getChanged()); } } } 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 cf58ae257..599a6dc9f 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -656,7 +656,7 @@ public class AWTRobotUtil { } } else if(NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { java.awt.Component comp = (java.awt.Component) obj; - for (wait=0; wait<POLL_DIVIDER && visible != comp.isVisible(); wait++) { + for (wait=0; wait<POLL_DIVIDER && visible != comp.isShowing(); wait++) { Thread.sleep(TIME_SLICE); } } else { @@ -719,7 +719,7 @@ public class AWTRobotUtil { } } else if (NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { java.awt.Component comp = (java.awt.Component) obj; - while( (t1-t0) < TIME_OUT && realized != comp.isDisplayable() ) { + while( (t1-t0) < TIME_OUT && realized != comp.isShowing() ) { if( null != waitAction ) { waitAction.run(); } else { |