[Openmcl-devel] Core Animation demo

Neil Baylis neil.baylis at gmail.com
Tue Jul 7 21:26:03 PDT 2009


On Jul 7, 2009, at 8:47 PM, Raffael Cavallaro wrote:

>
> I have noticed one issue with your demo - If I attempt to run it a
> second time without restarting ccl, the window appears, but without
> the sprite.
>

I'm not seeing this. If I close the window before starting a new  
instance, the new one seems to work correctly. If I leave the first  
window open and start a new one, then the first one no longer responds  
to mouse events, but is still visible. Can you say exactly what steps  
you perform to generate the error?

> There's this console error:
> 7/7/09 11:38:48 PM	dx86cl64[39512]	layer _NSViewBackingLayer(0x1be5d0)
> a={0, 0} p={0, 0} b=(0,0,900,600) superlayer=0x0 is already attached
> to a context

I think this message is referring to the layer that's associated with  
the entire view, not the one created by make-ca-layer. It has the same  
bounds as the view does. It's created (I believe) by the call:

(#/setWantsLayer: v #$YES)

>
> IOW, somehow the call to make-ca-layer is trying to re-use the same  
> ca-
> layer. I've found that changing this:
>
> (let* ((layer (#/init (objc:make-objc-instance "CALayer")))…
>
> to this:
>
> (let* ((layer (make-instance 'ns:ca-layer))…
>
> solves this issue, though I'm not sure why the first would produce
> different results than the second, but, at least on my setup, it does…

What happens if you use the first form (objc:make-objc-instance...)  
without calling #/init on it? (I only put the call to init there  
because I saw it in some sample code from Apple. I'm not sure what  
it's doing.)


Neil




More information about the Openmcl-devel mailing list