Fix CALayer/Display.setParent() initial position bug on OS X.
This commit is contained in:
parent
ec9b14090b
commit
cd666c66cf
|
@ -83,6 +83,26 @@ abstract class MacOSXCanvasPeerInfo extends MacOSXPeerInfo {
|
||||||
// fix for CALayer position not covering Canvas due to a Java 7 bug
|
// fix for CALayer position not covering Canvas due to a Java 7 bug
|
||||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7172187
|
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7172187
|
||||||
addComponentListener(component);
|
addComponentListener(component);
|
||||||
|
|
||||||
|
if (SwingUtilities.getWindowAncestor(component.getParent()) != null) {
|
||||||
|
Point componentPosition = SwingUtilities.convertPoint(component, component.getLocation(), null);
|
||||||
|
Point parentPosition = SwingUtilities.convertPoint(component.getParent(), component.getLocation(), null);
|
||||||
|
|
||||||
|
if (componentPosition.getX() == parentPosition.getX() && componentPosition.getY() == parentPosition.getY()) {
|
||||||
|
insets = getWindowInsets(component);
|
||||||
|
|
||||||
|
top = insets != null ? insets.top : 0;
|
||||||
|
left = insets != null ? insets.left : 0;
|
||||||
|
|
||||||
|
int x = (int)componentPosition.getX()-left;
|
||||||
|
int y = (int)-componentPosition.getY()+top-component.getHeight();
|
||||||
|
|
||||||
|
int width = component.getWidth();
|
||||||
|
int height = component.getHeight();
|
||||||
|
|
||||||
|
nSetLayerBounds(getHandle(), x, y, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NSControlLeftKeyMask = 0x0001,
|
NSControlLeftKeyMask = 0x0001,
|
||||||
NSControlRightKeyMask = 0x2000,
|
NSControlRightKeyMask = 0x2000,
|
||||||
NSShiftLeftKeyMask = 0x0002,
|
NSShiftLeftKeyMask = 0x0002,
|
||||||
NSShiftRightKeyMask = 0x0004,
|
NSShiftRightKeyMask = 0x0004,
|
||||||
NSCommandLeftKeyMask = 0x0008,
|
NSCommandLeftKeyMask = 0x0008,
|
||||||
NSCommandRightKeyMask = 0x0010,
|
NSCommandRightKeyMask = 0x0010,
|
||||||
NSAlternateLeftKeyMask = 0x0020,
|
NSAlternateLeftKeyMask = 0x0020,
|
||||||
NSAlternateRightKeyMask = 0x0040
|
NSAlternateRightKeyMask = 0x0040
|
||||||
};
|
};
|
||||||
|
|
||||||
@class NSOpenGLContext, NSOpenGLPixelFormat, MacOSXOpenGLView, MacOSXKeyableWindow;
|
@class NSOpenGLContext, NSOpenGLPixelFormat, MacOSXOpenGLView, MacOSXKeyableWindow;
|
||||||
|
|
Loading…
Reference in New Issue