http://www.jwz.org/xscreensaver/xscreensaver-5.07.tar.gz
[xscreensaver] / hacks / glx / crackberg.c
index 95787ab08ab6a534f0141d2babaf3df80ececc9f..376a41acca990eb66f1944ccfa8d17817a7e424a 100644 (file)
@@ -1,8 +1,10 @@
 /***************************
  ** crackberg; Matus Telgarsky [ catachresis@cmu.edu ] 2005 
  ** */
-#define XK_MISCELLANY
-#include <X11/keysymdef.h>
+#ifndef HAVE_COCOA
+# define XK_MISCELLANY
+# include <X11/keysymdef.h>
+#endif
 
 #define DEFAULTS    "*delay:        20000       \n" \
                     "*showFPS:      False       \n" \
@@ -18,9 +20,9 @@
 #define DEF_NSUBDIVS   "4"
 #define DEF_BORING     "False"
 #define DEF_CRACK      "True"
-#define DEF_NOWATER    "False"
+#define DEF_WATER      "True"
 #define DEF_FLAT       "True"
-#define DEF_COLOR      "plain"
+#define DEF_COLOR      "random"
 #define DEF_LIT        "True"
 #define DEF_VISIBILITY "0.6"
 #define DEF_LETTERBOX  "False"
@@ -138,7 +140,7 @@ struct _cberg_state {
  ** */
 
 static unsigned int nsubdivs;
-static Bool crack, boring, nowater, flat, lit, letterbox;
+static Bool crack, boring, do_water, flat, lit, letterbox;
 static float visibility;
 static char *color;
 
@@ -149,8 +151,8 @@ static XrmOptionDescRec opts[] = {
   {"-boring",     ".boring",     XrmoptionNoArg,  "True"},
   {"-crack",      ".crack",      XrmoptionNoArg,  "True"},
   {"-no-crack",   ".crack",      XrmoptionNoArg,  "False"},
-  {"-water",      ".nowater",    XrmoptionNoArg,  "False"},
-  {"-no-water",   ".nowater",    XrmoptionNoArg,  "True"},
+  {"-water",      ".water",      XrmoptionNoArg,  "True"},
+  {"-no-water",   ".water",      XrmoptionNoArg,  "False"},
   {"-flat",       ".flat",       XrmoptionNoArg,  "True"},
   {"-no-flat",    ".flat",       XrmoptionNoArg,  "False"},
   {"-color",      ".color",      XrmoptionSepArg, 0},
@@ -164,7 +166,7 @@ static argtype vars[] = {
   {&nsubdivs,   "nsubdivs",   "nsubdivs",   DEF_NSUBDIVS,   t_Int},
   {&boring,     "boring",     "boring",     DEF_BORING,     t_Bool},
   {&crack,      "crack",      "crack",      DEF_CRACK,      t_Bool},
-  {&nowater,    "nowater",    "nowater",    DEF_NOWATER,    t_Bool},
+  {&do_water,   "water",      "water",      DEF_WATER,      t_Bool},
   {&flat,       "flat",       "flat",       DEF_FLAT,       t_Bool},
   {&color,      "color",      "color",      DEF_COLOR,      t_String},
   {&lit,        "lit",        "lit",        DEF_LIT,        t_Bool},
@@ -430,7 +432,7 @@ static inline void trile_draw_vertex(cberg_state *cberg, unsigned int ix,
 {
     glColor3d(0.0, 0.0, 0.0); /* don't ask. my card breaks otherwise. */
     
-    if (!nowater && zcur <= 0.0) {
+    if (do_water && zcur <= 0.0) {
         cberg->color->water(cberg, zcur); /* XXX use average-of-3 for color when flat?*/
         if (lit) glNormal3d(0.0,0.0,1.0);
         glVertex3d(x, y, 0.0); 
@@ -1247,8 +1249,10 @@ ENTRYPOINT Bool crackberg_handle_event (ModeInfo *mi, XEvent *ev)
 
     if (ev->xany.type == KeyPress) {
         switch (XKeycodeToKeysym(mi->dpy, ev->xkey.keycode, 0)) {
+# ifndef HAVE_COCOA
             case XK_Left:   cberg->motion_state |= MOTION_LROT;  break;
             case XK_Right:  cberg->motion_state |= MOTION_RROT;  break;
+# endif
             case '1':       cberg->motion_state |= MOTION_DEC;   break; 
             case '2':       cberg->motion_state |= MOTION_INC;   break;
             case 'a':       cberg->motion_state |= MOTION_LEFT;  break;
@@ -1273,8 +1277,10 @@ ENTRYPOINT Bool crackberg_handle_event (ModeInfo *mi, XEvent *ev)
 #endif
 
         switch (XKeycodeToKeysym(mi->dpy, ev->xkey.keycode, 0)) {
+# ifndef HAVE_COCOA
             case XK_Left:   cberg->motion_state &= ~MOTION_LROT;  break;
             case XK_Right:  cberg->motion_state &= ~MOTION_RROT;  break;
+# endif
             case '1':       cberg->motion_state &= ~MOTION_DEC;   break; 
             case '2':       cberg->motion_state &= ~MOTION_INC;   break;
             case 'a':       cberg->motion_state &= ~MOTION_LEFT;  break;