diff options
author | Sven Gothel <[email protected]> | 2013-10-03 15:19:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-03 15:19:29 +0200 |
commit | 7f7275834922b9c30aec6520dc5c5f20939a49d8 (patch) | |
tree | 60ba99266d9a869c5f727ecd91c241dce24ca528 /src/nativewindow/classes/com/jogamp | |
parent | 60968cdc388b6a7464da3a6b58f25cb61e29f681 (diff) |
Bug 816 (OSX CALayer pos): Fix location on 'inner CALayer' calculation
'inner CALayer' is the outter AWT Window client space (content).
+++
Pseudo-Code:
p0 = c.locationOnScreen();
p0 -= c.getOutterComp.getPos();
p0 -= c.getOutterComp.getInsets();
Where 'locationOnScreen()' is:
p0 = 0/0;
while( null != c ) {
p0 += c.getPos();
}
+++
JAWTWindow.getLocationOnScreenNonBlocking(..) validated against
AWT's Component.getLocationOnScreen() - OK for all use-cases.
(Validation enabled w/ DEBUG)
All unit tests manually validated on OSX 10.7 w/ jdk7u40.
Diffstat (limited to 'src/nativewindow/classes/com/jogamp')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 5b5df7f68..53eb985b2 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -61,7 +61,6 @@ import javax.media.nativewindow.util.InsetsImmutable; import javax.media.nativewindow.util.Point; import javax.media.nativewindow.util.Rectangle; import javax.media.nativewindow.util.RectangleImmutable; -import javax.swing.JRootPane; import jogamp.nativewindow.SurfaceUpdatedHelper; import jogamp.nativewindow.awt.AWTMisc; @@ -574,23 +573,26 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, protected abstract Point getLocationOnScreenNativeImpl(int x, int y); protected static Component getLocationOnScreenNonBlocking(Point storage, Component comp) { + final java.awt.Insets insets = new java.awt.Insets(0, 0, 0, 0); // DEBUG Component last = null; while(null != comp) { final int dx = comp.getX(); final int dy = comp.getY(); 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+"] -> "); + final java.awt.Insets ins = AWTMisc.getInsets(comp, false); + if( null != ins ) { + insets.bottom += ins.bottom; + insets.top += ins.top; + insets.left += ins.left; + insets.right += ins.right; + } + System.err.print("LOS: "+storage+" + "+comp.getClass().getName()+"["+dx+"/"+dy+", vis "+comp.isVisible()+", ins "+ins+" -> "+insets+"] -> "); } 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(); } return last; |