diff options
author | Sven Gothel <[email protected]> | 2013-02-22 04:01:44 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-22 04:01:44 +0100 |
commit | cbd8e33f1e19cf0c061c371af6930aba7c36b84f (patch) | |
tree | 1d544d245a80622c6a5c258c1ad9cb4ee3cdb95c /src/nativewindow/classes | |
parent | 405bc071d5d13e00d0561a485d31e3a7d61bf167 (diff) |
Fix CALayer pos/size and animation.b01
- Fix CALayer animation:
- All CALayer animations are set to nil via overriding 'actionForKey'
- Fix CALayer pos/size bug:
- Fix root and sub CALayer position to 0/0 and size on the main-thread w/o blocking.
- If the sub CALayer implements the Objective-C NativeWindow protocol NWDedicatedSize (e.g. JOGL's MyNSOpenGLLayer),
the dedicated size is passed to the layer, which propagates it appropriately.
- On OSX/Java7 our root CALayer's frame position and size gets corrupted by its NSView,
hence we have created the NWDedicatedSize protocol.
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java | 2 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index b25836d3c..3ec54ca78 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -125,7 +125,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { if(DEBUG) { System.err.println("JAWTWindow.fixSurfaceLayerLayout: "+toHexString(osl) + ", bounds "+bounds+", "+w+"x"+h); } - OSXUtil.FixCALayerPosition(rootSurfaceLayerHandle, osl, w, h); + OSXUtil.FixCALayerLayout(rootSurfaceLayerHandle, osl, w, h); } protected void detachSurfaceLayerImpl(final long layerHandle) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index 5ff451cc0..aa44e2d64 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -173,10 +173,14 @@ public class OSXUtil implements ToolkitProperties { } /** - * Fix root and sub CALayer position to 0/0 on the main-thread w/o blocking. + * Fix root and sub CALayer position to 0/0 and size on the main-thread w/o blocking. * <p> - * For an unknown reason, on OSX/Java7 our root CALayer's frame position gets corrupted - * and is moved out of 'sight' .. or oddly half way to the upper right corner. + * If the sub CALayer implements the Objective-C NativeWindow protocol NWDedicatedSize (e.g. JOGL's MyNSOpenGLLayer), + * the dedicated size is passed to the layer, which propagates it appropriately. + * </p> + * <p> + * On OSX/Java7 our root CALayer's frame position and size gets corrupted by its NSView, + * hence we have created the NWDedicatedSize protocol. * </p> * * @param rootCALayer the root surface layer, maybe null. @@ -184,13 +188,13 @@ public class OSXUtil implements ToolkitProperties { * @param width the expected width * @param height the expected height */ - public static void FixCALayerPosition(final long rootCALayer, final long subCALayer, final int width, final int height) { + public static void FixCALayerLayout(final long rootCALayer, final long subCALayer, final int width, final int height) { if( 0==rootCALayer && 0==subCALayer ) { return; } RunOnMainThread(false, new Runnable() { public void run() { - FixCALayerPosition0(rootCALayer, subCALayer, width, height); + FixCALayerLayout0(rootCALayer, subCALayer, width, height); } }); } @@ -346,7 +350,7 @@ public class OSXUtil implements ToolkitProperties { private static native long GetNSWindow0(long nsView); private static native long CreateCALayer0(int x, int y, int width, int height); private static native void AddCASublayer0(long rootCALayer, long subCALayer); - private static native void FixCALayerPosition0(long rootCALayer, long subCALayer, int width, int height); + private static native void FixCALayerLayout0(long rootCALayer, long subCALayer, int width, int height); private static native void RemoveCASublayer0(long rootCALayer, long subCALayer); private static native void DestroyCALayer0(long caLayer); private static native void RunOnMainThread0(Runnable runnable); |