From http://www.jwz.org/xscreensaver/xscreensaver-5.18.tar.gz
[xscreensaver] / README.hacking
index 28767a5fb7ebe30936a756769f168c73484c01bd..718cae2b150804629081a0982048c5c2bfea079a 100644 (file)
@@ -5,6 +5,19 @@
 
 ==========================================================================
 
+Any program that can be made to render on an X window created by another
+process can be used as a screen saver.  Just get the window ID out of
+$XSCREENSAVER_WINDOW, draw on that, and you're done.
+
+In theory, you can write a screen saver in any language you like.  In
+practice, however, languages other than C or C++ tend not to allow you to
+draw to windows that they did not create themselves.  Unfortunately, this
+means that if you want to write a screen saver, you must write it in C.
+
+Given that you're going to be writing in C, you might as well take
+advantage of the various utility functions that I have written to make
+that easier.  Writing a new screen saver in C using the frameworks
+included with xscreensaver simplifies things enormously.
 
 Generally, the best way to learn how to do something is to find a similar
 program, and play around with it until you understand it.  Another
@@ -14,8 +27,8 @@ xscreensaver demos, included in the "hacks/" directory, rename the file,
 and edit it until it does what you want.
 
 The "Greynetic" and "Deluxe" hacks are probably good ones to start with,
-since they are so very simple.  For GL programs, "DangerBall" is a good
-example.
+since they are so very simple.  For OpenGL programs, "DangerBall" is a
+good example.
 
 
 ==========================================================================
@@ -56,9 +69,13 @@ The XScreenSaver API
       yoursavername_free     -- Free everything you've allocated.
       yoursavername_reshape  -- Called when the window is resized.
       yoursavername_event    -- Called when a keyboard or mouse event happens.
-                                The "reshape" and "event" functions are only
-                                called when running in a window (not as a
-                                screen saver). It's ok for them to do nothing.
+
+      The "event" function will only be called when running in a window
+      (not as a screen saver).  The "reshape" event will be called when the
+      window size changes, or (as a screen saver) when the display size
+      changes as a result of a RANDR event (e.g., plugging in a new monitor).
+
+      It's ok for both the "event" and "resize" functions to do nothing.
 
   - All other functions should be static.
 
@@ -94,7 +111,7 @@ The XLockMore API
   hacks like "Flag".  The XLockMore ones are the ones that begin with
   "#ifdef STANDALONE" and #include "xlockmore.h".
 
-  All of the OpenGL screen savers follow the XLockMore API.
+  But, all OpenGL screen savers have to follow the XLockMore API.
 
   The XLockMore API is similar to the XScreenSaver API, in that you define
   (roughly) the same set of functions, but the naming conventions are
@@ -157,7 +174,7 @@ The MacOS X Port
 
   To compile on MacOS, use the XCode project included in the source
   distribution.  You shouldn't need to have X11 installed, and shouldn't
-  need to run "configure" first.  MacOS 10.4.0 and XCode 2.5 or newer are
+  need to run "configure" first.  MacOS 10.4.0 and XCode 3.1 or newer are
   required.
 
 ==========================================================================