Re: ScreenSaverView gets instantiated several times
Re: ScreenSaverView gets instantiated several times
- Subject: Re: ScreenSaverView gets instantiated several times
- From: Gabriel Zachmann <email@hidden>
- Date: Mon, 5 Oct 2009 10:39:16 +0200
When the user clicks 'Test' in System Preferences, it "just"
creates a new instance of your subclass of ScreenSaverView!
Do you really find that fact to be "shocking"?
Yes, I do.
In particular, because it has a major impact on the way one has to
design the code.
For instance, if changing the configuration causes some longish
computations.
I tried pretty hard to hide this from the user, so that after applying
the changes of the configuration of my screen saver, the user does not
have to wait for tens of seconds until the screen saver resumes
operation.
Now, the design I chose to achieve this is useless, because when the
user clicks 'Test', System Preferences just goes ahead and creates a
new instance!
Now, it seems that I have no other choice than keep up the modal panel
until the computations ensuing the config chance are finished ;-(
If only Apple would have said so in big letters at the beginning of
the docs of ScreenSaverView!
What did you suppose would happen (not that suppositions and
assumptions are worth much)?
I supposed that the screen saver manager would just call -
initWithFrame: again.
Extra credit: the user has multiple displays attached, "Main screen
only" option is off, and the user clicks the Test button or
activates your screen saver (hot corner, inactivity). What do you
expect will happen then?
I assumed it would load(!) & run the screen saver bundle multiple times.
And it's not that this assumption is complete nonsense, is it?
What actually does happen?
With multiple displays I have no idea, since I've got only one display.
But now I "assume" that it loads the bundle once and creates multiple
instances ...
it's really just a way to say "Yes, you must be prepared for
multiple instances of your screen saver view to exist simultaneously".
Again, if only Apple would have said that in the docs!
Best regards,
Gabriel.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden