ScreenSavers

Screensavers on Windows

  • are a Windows GUI application with the extension ".scr"
  • have a fixed format for the description ("SCRNSAVE : Screensavername") which has to be in the string table, with ordinal 1
  • have a fixed set of command-line options (case-independent):

    /c

    Open the Configuration dialog

    /s

    Save the screen i.e. start in a full-screen window

    /p 12345

    Display a preview with the decimal hWnd as parent window (a Control Panel applet)

    /a 45678

    Open the "Change Password" dialog with the decimal hWnd as parent window

  • expect to run continuously and be able to render as many frames as they want.
  • currently run fine with Wine. (Well, as good as any other program can be expected to run.)


Using a Windows screensaver

  • Who starts the screensaver?
    • The system, for blanking (might be "user32.dll"; I'm not sure)

    • The Control Panel ("desk.cpl"), for configuration and preview

    • The user, by running the .scr directly


Creating a Windows screensaver

  • "scrnsave.lib":
    • WinMain() entry point for the screensaver

    • RegisterClass() for "WindowsScreenSaverClass"

    • Argument parsing
    • Resource handling
    • Dialog creation
    • Screensaver window creation
    • DefScreenSaverProc() for message handling

    • Various global variables and functions are used
    • Password handling
  • "scrnsave.h":

    • Fixed id's for the resources (icon, dialogs, strings)
    • Global variables, that the user of "scrnsave.lib" must provide

    • Specific functions, that the user of "scrnsave.lib" must provide

  • The screensaver's source code, which is linked with "scrnsave.lib"


ScreenSavers on Linux

  • XScreenSaver
    • http://www.jwz.org/xscreensaver/

    • An XML file for the description and configuration
    • The environment variable XSCREENSAVER_WINDOW is set to the X "Window" where the graphic should be displayed
    • Password and message handling is done by the daemon.
    • Exactly one frame is rendered for every frame that X11 displays
    • To close the screensaver, the process is killed


Creating a Linux screensaver

  • "screenhack.h":

    • A macro for creating a global structure with predefined callbacks
  • "screenhack.c":

    • Framework for the callbacks
  • The screensaver's source code, which is linked with "screenhack.o"


Using a Linux screensaver

  • The "XSCREENSAVER_WINDOW" variable is the API (which is also used by other screensaver backends, like gnome-screensaver)

  • A daemon as backend starts the screensaver
  • xscreensaver-demo for configuration and preview


Screensavers on Wine

  • When you run screensavers with Wine without an argument, most of them start with the configuration screen. But some need the argument /C for it.

    • e.g.: wine /yourpath/to/screensaver.scr /C

  • If you want to be sure, it is better to always use that argument. (Some start in screensaver mode when you run them without an argument, but rather few, e.g. current version 1.2 of this one.)

  • You have to use the argument /S to start the main screensaver part of most screensavers.

    • e.g.: wine /yourpath/to/screensaver.scr /S

  • If you need a screensaver to test with,


Improve Wine for screensavers

  • (I have a hack that displays a Windows screensaver in the Preview window of xscreensaver-demo)

  • Fun Projects: Integrate Windows screensavers

  • (./) "wine screensaver.scr /c" works like a normal application

  • (./) "wine screensaver.scr /s" opens the graphic

  • {X} message handling (keyboard and mouse) is not correct

  • {X} scrnsave.h not present

  • {X} scrnsave.lib not present

  • {X} An example screensaver is not present

ScreenSavers (last edited 2009-01-24 15:00:21 by AlexanderScottJohns)