Solved: how to act when screen saver *really* stops
Solved: how to act when screen saver *really* stops
- Subject: Solved: how to act when screen saver *really* stops
- From: email@hidden
- Date: Sun, 18 Jan 2004 19:15:41 -0500
How I ended up solving it
I never did find a way to distinguish the screen saver "really" stopping as opposed to a "stopAnimation" message sent by the power manager when the screen is put to sleep.
So, I have the screen saver spawn, as a separate process, a little Unix command-line-level program. The screen saver opens a pipe to provide the standard input of this second program, but never writes anything into the pipe. The second program reads from the standard input -- which puts it into a wait state waiting for something to come down the pipe.
When the screen saver "really" ends the pipe becomes broken, and the secondary program wakes up and gets an "end of file" indication back from its pipe read. Then it proceeds to do the tidy up that I was trying to handle in the screen saver before.
A bit rube-goldbergesque, but it works very reliably.
It wouldn't work, of course, for a case where it was important to learn of the termination of the screen saver from within the screen saver module -- this technique relies on watching the screen saver module die from a safe distance.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.