From 3abff83dbc0a99c8d227788c9dddbe59cd15b9ba Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 27 Sep 2013 15:31:17 +0200 Subject: Fix Bug 816: JAWTWindow.getLocationOnScreenNonBlocking(..) shall use JRootPane for last position offset; AWTMisc.getInsets(..) add special JRootPane case. Please note that we use JAWTWindow.getLocationOnScreenNonBlocking(..) to determine the location on the screen 'only' b/c we cannot allow AWT to aquire the tree-lock! The latter would be the case if using AWT's 'getLocationOnScreen()'. If anybody has a more reliable implementation to achieve the same .. please provide your patch! The following fix has been performed to fix the last issue w/ vZome. - JAWTWindow.getLocationOnScreenNonBlocking(..) shall use JRootPane for last position offset - w/ vZome, the frame's position was 0/0 (invalid), instead JRootPane's position is good. Use JRootPane's position and stop traversing here (LW top-level). - AWTMisc.getInsets(..) add special JRootPane case. + * Exception is JRootPane. + * Return it's parent's Window component's insets if available, + * otherwise return JRootPane's insets.
+ * This is due to experience that some JRootPane's + * do not expose valid insets value. - --- .../com/jogamp/nativewindow/awt/JAWTWindow.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/nativewindow/classes/com/jogamp') 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(); } -- cgit v1.2.3