I have an GUI cocoa application that is automatically started when the computer is woken from sleep. The application runs in multiple users accounts at the same time and is sometime launched in a user account that is not the current user being displayed on screen (i.e. the active console user). This is where the problem arises.
I have a custom view that uses CALayer
to display a composition of a couple different images. The CALayer of the NSView contains two sublayers of which one then contains two sublayers also. When the application is launched in the active user's account by the user there are no problem. When the application is launched by an automated script in a non active user's account the custom NSView does not draw any of the CALayers. I injected F-Script into the app while it was not drawing the CALayer and noticed that the custom NSView's layer
did not contain any sublayers
! Note that the layer setup code is contained in the -awakeFromNib
of the custom NSView. I tried calling -awakeFromNib
on manually when the custom NSView was not drawing and it fix the problem (although it did set the sublayers
correctly).
I searched the net and found this bit of information:
In OS X v.10.4 and later, the display link thread is automatically stopped if the user employs Fast User Switching. The display link is restarted when switching back to the original user.
I know my problem has something to do with the user not having a reference to an active screen (a 'good' CGContext reference?) but I have not received any error messages and don't have the Quartz / Core Animation experience to point me in the开发者_如何学Python right direction.
Thank you in advance for you help!
精彩评论