RE: screensaver madness... (the results)
RE: screensaver madness... (the results)
- Subject: RE: screensaver madness... (the results)
- From: "Matt Pease" <email@hidden>
- Date: Thu, 24 Apr 2003 18:16:28 +0200
Hello Cocoa Puffs -
I just wanted to post how I ended up doing this for the benefit
of the archive dwellers.
If you need to write an OSX screensaver using Carbon, for whatever
reason, here is one way to do it.
The screensaver will act as a trigger. It should implement
the ScreenSaverView class, as per Apple docs. It can then
signal the carbon screensaver app via an AppleEvent. It may need
to start the carbon screensaver first, if its not already running.
The Cocoa saver will draw a window itself, top most & won't allow
the Carbon window above the Cocoa window. To get around that, you
can make the Cocoa saver's window transparent with such code:
implement animateOneFrame to call setNeedsDisplay:YES
(this will force the saver api to call yourr Cocoa saver's
drawRect method)
drawRect should fill the passed rect with a clear color & set its AlphaValue
to 0.0:
[[NSColor clearColor] set];
NSRectFill([self frame]);
[[self window] setAlphaValue:0.0];
Thats about it. Cocoa should probably also appleevent Carbon when it quits
itself.
Fun fun fun!
-matt
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of David Hill
>
Sent: Thursday, April 24, 2003 1:41 AM
>
To: Matt Pease
>
Cc: email@hidden
>
Subject: Re: screensaver madness...
>
>
>
I'll go ahead and answer your second question since nobody else has
>
chimed in.
>
>
Your best bet would be to install an NSQuickDrawView into your
>
screensaver view programmatically when your screensaver starts up.
>
From there, you can get a CGrafPtr and use your Carbon code (QuickDraw,
>
I presume) to draw.
>
>
Here's an older sample that shows how to install the subview in your
>
screensaver view.
>
>
[demime 0.98b removed an attachment of type multipart/x-folder
>
which had a name of Quickdraw]
>
Dave
>
>
>
On Wednesday, April 23, 2003, at 04:28 AM, Matt Pease wrote:
>
>
> Hello all-
>
>
>
> I've got a couple questions regarding the cocoa ScreenSaverView api.
>
>
>
> 1. Is it possible for the saver to quit itself? Can I send a message
>
> somehow to the parent class that its time to stop? or,
>
>
>
> 2. Can I get a CGraphPtr to the ScreenSaverView window? I could
>
> send this along to my Carbon saver to give it what it needs to draw.
>
>
>
>
>
> What got me into this mess...
>
>
>
> For certain reasons, my screensaver needs to be written in Carbon /
>
> CFM.
>
> So I'm using a "shell" cocoa saver extending the ScreenSaverView class.
>
>
>
> My "saver" simply sends an apple event to my carbon app from it's
>
> startAnimation method.
>
> My carbon app (the real saver), creates a full-screen window, raises
>
> itself
>
> topmost
>
> (using SetFrontProcess & UDesktop::SelectDeskWindow -- a powerplant
>
> class)
>
> & begins drawing.
>
>
>
> What happens is this: the "shell" saver (Cocoa) window takes over the
>
> screen, and
>
> somehow my app can't draw. However, if I move my mouse a little, the
>
> cocoa
>
> "saver" quits & then the carbon app is able to draw.
>
>
>
> I tried returning "NO" from performGammaFade; over-riding drawRect
>
> with an empty fxn; & setting backingStoreType to
>
> NSBackingStoreNonretained.
>
>
>
>
>
>
>
> I get the feeling that ththe Cocoa ScreenSaverView system severely
>
> limits
>
> what can be done from the screensaver-- probably for security reasons?
>
> Anyhow, it'd be sweet to hear what anyone here thinks of this.
>
>
>
> Thanks-
>
> Matt
>
> _______________________________________________
>
> 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.
>
_______________________________________________
>
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.
_______________________________________________
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.