diff -r 011594a05a1a src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java @@ -209,7 +209,7 @@ LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer(); int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor(); - Rectangle bounds = ((LightweightFrame)peer.getTarget()).getBounds(); + Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds(); for (GraphicsDevice d : ge.getScreenDevices()) { if (d.getDefaultConfiguration().getBounds().intersects(bounds) && ((CGraphicsDevice)d).getScaleFactor() == scale) diff -r 011594a05a1a src/share/classes/sun/awt/LightweightFrame.java --- a/src/share/classes/sun/awt/LightweightFrame.java +++ b/src/share/classes/sun/awt/LightweightFrame.java @@ -31,6 +31,7 @@ import java.awt.Image; import java.awt.MenuBar; import java.awt.MenuComponent; +import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.peer.FramePeer; @@ -140,4 +141,31 @@ * @param scale the factor */ public abstract void setScaleFactor(int scale); + + /** Host window absolute bounds. */ + private int hostX, hostY, hostW, hostH; + + /** + * Returns the absolute bounds of the host (embedding) window. + * + * @return the host window bounds + */ + public Rectangle getHostBounds() { + if (hostX == 0 && hostY == 0 && hostW == 0 && hostH == 0) { + // The client app is probably unaware of the setHostBounds. + // A safe fall-back: + return getBounds(); + } + return new Rectangle(hostX, hostY, hostW, hostH); + } + + /** + * Sets the absolute bounds of the host (embedding) window. + */ + public void setHostBounds(int x, int y, int w, int h) { + hostX = x; + hostY = y; + hostW = w; + hostH = h; + } }