diff options
-rw-r--r-- | make/scripts/tests.sh | 4 | ||||
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 24 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java | 18 |
3 files changed, 33 insertions, 13 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 442b12672..8c58efb3f 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -332,7 +332,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering2GL2NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT $* -testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $* #testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 $* #testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT $* #testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT $* @@ -454,7 +454,7 @@ testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $* -#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPosAWT $* +testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPosAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $* diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 576fcf4ed..5b5df7f68 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -64,6 +64,7 @@ import javax.media.nativewindow.util.RectangleImmutable; import javax.swing.JRootPane; import jogamp.nativewindow.SurfaceUpdatedHelper; +import jogamp.nativewindow.awt.AWTMisc; import jogamp.nativewindow.jawt.JAWT; import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.nativewindow.jawt.JAWT_Rectangle; @@ -577,17 +578,18 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, while(null != comp) { final int dx = comp.getX(); final int dy = comp.getY(); - if( ! ( comp instanceof JRootPane ) ) { - if( DEBUG ) { - System.err.print("LOS: "+storage+" + "+comp.getClass().getSimpleName()+"["+dx+"/"+dy+"] -> "); - } - storage.translate(dx, dy); - if( DEBUG ) { - System.err.println(storage); - } - last = comp; - } else if( DEBUG ) { - System.err.println("LOS: ignore "+comp.getClass().getSimpleName()+"["+dx+"/"+dy+"]"); + if( DEBUG ) { + final java.awt.Insets ins = AWTMisc.getInsets(comp); + System.err.print("LOS: "+storage+" + "+comp.getClass().getName()+"["+dx+"/"+dy+", vis "+comp.isVisible()+", ins "+ins+"] -> "); + } + storage.translate(dx, dy); + if( DEBUG ) { + System.err.println(storage); + } + last = comp; + if( comp instanceof JRootPane ) { + // LW JRootPane is considered a top-level component! + break; } comp = comp.getParent(); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java index e326b65bd..611c13a22 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java +++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java @@ -72,10 +72,28 @@ public class AWTMisc { return (Container) c; } + /** + * Return insets of the component w/o traversing up to parent, + * i.e. trying Window and JComponent. + * <p> + * Exception is JRootPane. + * Return it's parent's Window component's insets if available, + * otherwise return JRootPane's insets.<br> + * This is due to <i>experience</i> that <i>some</i> JRootPane's + * do not expose valid insets value. + * </p> + */ public static Insets getInsets(Component c) { if( c instanceof Window ) { return ((Window)c).getInsets(); } + if( c instanceof JRootPane ) { + final Window w = getWindow(c); + if( null != w ) { + return w.getInsets(); + } + return ((JRootPane)c).getInsets(); + } if( c instanceof JComponent ) { return ((JComponent)c).getInsets(); } |