cocoa question/issue

Nibbie
Posts: 3
Joined: 2011.02
Post: #1
Hello all. I am porting my Windows screensaver called Dream Aquarium over to mac OSX. I am fairly new to cocoa but have been doing pretty well with the port so far. This screensaver is quite involved and has its own gui interface for adjusting parameters, adding fish, managing fishtanks etc… It's all openGL using the screensaver framework (based on Cocoa's ScreenSaverView class which is a subclass of NSView) and I am capturing and processing all the keyboard and mouse events.

The issue I'm struggling with is being able to opening a file requester from the screensaver (for the user to choose images). I can open an NSOpenPanel but it puts the panel on the desktop, underneath my fullscreen openGL window so it's inaccessible. My solution to that was to miniaturize the screensaver (to temporarily reveal the desktop and file requester) and then de-minaturize it after the user chooses the file. The problem I'm getting is that when the desktop/filerequester is shown, if the user clicks anything on the desktop outside of the file requester, my screensaver seems to receive a shut-down (stopAnimation) signal. I'm not knowledgeable enough with cocoa to determine what event or action message the ScreenSaverView might be receiving that tells it to shut down. I assume if I could capture this event or action message I could prevent the shutdown? I feel like I'm fighting the ScreenSaverView's natural tendency to shut off.

-Does anyone have insight as to what event or action the ScreenSaverView may be receiving? How I could go about determining this? Is there some way to monitor all the events and action messages that ScreenSaverView is getting?
-Am I even going about this the right way? Is there a way to put the file requester right on my fullscreen OpenGL window?

Thanks all for any response.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
You're doing it wrong. Put your UI in the screensaver settings panel where it's supposed to be, and don't try to handle events while the screensaver is running.
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2011.02
Post: #3
I realize that's the usual way of doing things, but I (and my users) enjoy the interactive aspect of the screensaver and the instant feedback of being able to feed and add fish, manipulate tanks, change camera angles etc... while the action is happening. I already have the whole in-screensaver gui working fine, it's only when I need to open a file requester that the problem happens. If you want to take a look at how it works on Windows, you can check it out here: dreamaquarium.com
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #4
Yes, but that's now how things are done here.
On macs, your users will be mac users, and thus do things the mac way.
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2011.02
Post: #5
I should really call this a virtual aquarium rather than a screensaver, it just happens that it kicks in when the computer is idle. Part of its purpose is to be an interactive experience - something my users really like about it. This quality would be lost if everything were done in a settings panel. This was one of my philosophies when I started out - that the user can meddle with the aquarium settings while they see it change in front of them, much like a real aquarium. You can interactively select fish from a palette and you see them swim in to the tank as you select them, or alternately pick specific fish in your tank to delete and see them disappear mid-swim. You can drop in food and in the future, tap on the glass and have the fish scatter. Also, I'd like to have one gui across all platforms (and eventually linux) so that there is a unified way of doing things for all users regardless of OS. I admit/know it's not the normal or mac-specific way of doing things, but I think the end user experience is worth the breach of protocol. Isn't interactivity and tactile manipulation part of the mac philosophy and user experience as well? I guess the idea here is to not actually think of it as a screensaver if that helps.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
Then implement it as an app which happens to have an "activate after delay" feature. Plus that way you can sell it on the MAS.
Quote this message in a reply
Post Reply