Screen Saver: Talking to ScreenSaver

Screen Saver Table of Contents | Screen Saver Index

# Talking to ScreenSaver

If you've installed your screen saver module in the right place (see "Building and Installing your Add-on"), the ScreenSaver preferences panel will automatically find it and, at the user's request, display a preview of your saver. It does this by loading your add-on and calling your BScreenSaver's hook functions.

As shown below, The panel displays two views that you can draw into: a preview monitor that displays a miniature version of your screen saver, and a configuration view that you can fill with controls, credits, and so on.

The hook functions that give you access to these views are:

- `StartSaver()` gives you a pointer to the preview monitor. You can initialize the view's state, but you don't draw into it from `StartSaver()`—you have to wait for `Draw()` to be called. (Note that the ScreenSaver only calls `Draw()`; you can't use `DirectDraw()` to draw your preview.) The preview is drawn into an offscreen bitmap and then copied to the preview area for added smoothness.

- `StartConfig()` gives you a pointer to the configuration view. You draw into the configuration view directly from within `StartConfig()`.

Note that it's possible for your screen saver module to be loaded by the ScreenSaver preferences app and screen_blanker at the same time. Since copies of the add-on are loaded into separate address spaces, you don>t normally need to worry about this—unless you>re doing something extremely weird.

Screen Saver Table of Contents | Screen Saver Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..