From be91765959db646cca0b03537f140da9fecd7450 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Mon, 13 Feb 2012 14:27:53 +0100
Subject: OSX CALayer fix for Java7 (force CALayer to 0/0, always remove all
 animations)

---
 src/nativewindow/native/macosx/OSXmisc.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/nativewindow/native/macosx/OSXmisc.m')

diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index eec9b2a01..38ffde98b 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -242,6 +242,9 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0
     lRect.size.width = 32;
     lRect.size.height = 32;
     [layer setFrame: lRect];
+    // no animations for add/remove/swap sublayers etc 
+    // doesn't work: [layer removeAnimationForKey: kCAOnOrderIn, kCAOnOrderOut, kCATransition]
+    [layer removeAllAnimations];
     DBG_PRINT("CALayer::CreateCALayer.1: %p %lf/%lf %lfx%lf\n", layer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
     DBG_PRINT("CALayer::CreateCALayer.X: %p (refcnt %d)\n", layer, (int)[layer retainCount]);
 
@@ -265,7 +268,7 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
     CGRect lRectRoot = [rootLayer frame];
     DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n", 
         rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
-    if(lRectRoot.origin.x<0 || lRectRoot.origin.y<0) {
+    if(lRectRoot.origin.x!=0 || lRectRoot.origin.y!=0) {
         lRectRoot.origin.x = 0;
         lRectRoot.origin.y = 0;
         [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
-- 
cgit v1.2.3