ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.21.tar.gz
[xscreensaver] / hacks / glx / lavalite.c
index 8c2d800c2f4b353daeee0d39ab4bfa430dc39943..d5d913276cf0bb84fd5e93480aedc2404211386a 100644 (file)
@@ -1,6 +1,6 @@
 /* lavalite --- 3D Simulation a Lava Lite, written by jwz.
  *
- * This software Copyright (c) 2002 Jamie Zawinski <jwz@jwz.org>
+ * This software Copyright (c) 2002-2004 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -93,26 +93,11 @@ extern XtAppContext app;
 #define DEF_BTEX       "(none)"
 #define DEF_TTEX       "(none)"
 
-#define DEFAULTS       "*delay:        10000       \n" \
+#define DEFAULTS       "*delay:        30000       \n" \
                        "*showFPS:      False       \n" \
                        "*wireframe:    False       \n" \
+                       "*geometry:     600x900\n"      \
                        "*count:      " DEF_COUNT " \n" \
-                       "*style:      " DEF_STYLE " \n" \
-                       "*speed:      " DEF_SPEED " \n" \
-                       "*spin:       " DEF_SPIN   "\n" \
-                       "*wander:     " DEF_WANDER "\n" \
-                       "*resolution: " DEF_RESOLUTION "\n" \
-                       "*smooth: "     DEF_SMOOTH "\n" \
-                       "*impatient:  " DEF_IMPATIENT " \n" \
-                       "*geometry:     600x900\n" \
-                       "*lavaColor:  " DEF_LCOLOR "\n" \
-                       "*fluidColor: " DEF_FCOLOR "\n" \
-                       "*baseColor:  " DEF_BCOLOR "\n" \
-                       "*tableColor: " DEF_TCOLOR "\n" \
-                       "*fluidTexture: "       DEF_FTEX "\n" \
-                       "*baseTexture:  "       DEF_BTEX "\n" \
-                       "*tableTexture: "       DEF_TTEX "\n" \
-
 
 #define BLOBS_PER_GROUP 4
 
@@ -297,22 +282,22 @@ static XrmOptionDescRec opts[] = {
 };
 
 static argtype vars[] = {
-  {(caddr_t *) &do_style,  "style",  "Style",  DEF_STYLE,  t_String},
-  {(caddr_t *) &do_spin,   "spin",   "Spin",   DEF_SPIN,   t_String},
-  {(caddr_t *) &do_wander, "wander", "Wander", DEF_WANDER, t_Bool},
-  {(caddr_t *) &speed,     "speed",  "Speed",  DEF_SPEED,  t_Float},
-  {(caddr_t *) &resolution, "resolution", "Resolution", DEF_RESOLUTION, t_Int},
-  {(caddr_t *) &do_smooth,  "smooth", "Smooth", DEF_SMOOTH, t_Bool},
-  {(caddr_t *) &do_impatient, "impatient", "Impatient", DEF_IMPATIENT, t_Bool},
-
-  {(caddr_t *) &lava_color_str, "lavaColor", "LavaColor", DEF_LCOLOR,t_String},
-  {(caddr_t *) &fluid_color_str,"fluidColor","FluidColor",DEF_FCOLOR,t_String},
-  {(caddr_t *) &base_color_str, "baseColor", "BaseColor", DEF_BCOLOR,t_String},
-  {(caddr_t *) &table_color_str,"tableColor","TableColor",DEF_TCOLOR,t_String},
-
-  {(caddr_t *) &fluid_tex, "fluidTexture", "FluidTexture", DEF_FTEX, t_String},
-  {(caddr_t *) &base_tex,  "baseTexture",  "BaseTexture",  DEF_BTEX, t_String},
-  {(caddr_t *) &table_tex, "tableTexture", "BaseTexture",  DEF_TTEX, t_String},
+  {&do_style,     "style",      "Style",      DEF_STYLE,      t_String},
+  {&do_spin,      "spin",       "Spin",       DEF_SPIN,       t_String},
+  {&do_wander,    "wander",     "Wander",     DEF_WANDER,     t_Bool},
+  {&speed,        "speed",      "Speed",      DEF_SPEED,      t_Float},
+  {&resolution,   "resolution", "Resolution", DEF_RESOLUTION, t_Int},
+  {&do_smooth,    "smooth",     "Smooth",     DEF_SMOOTH,     t_Bool},
+  {&do_impatient, "impatient",  "Impatient",  DEF_IMPATIENT,  t_Bool},
+
+  {&lava_color_str,  "lavaColor",    "LavaColor",  DEF_LCOLOR, t_String},
+  {&fluid_color_str, "fluidColor",   "FluidColor", DEF_FCOLOR, t_String},
+  {&base_color_str,  "baseColor",    "BaseColor",  DEF_BCOLOR, t_String},
+  {&table_color_str, "tableColor",   "TableColor", DEF_TCOLOR, t_String},
+
+  {&fluid_tex,       "fluidTexture", "FluidTexture", DEF_FTEX, t_String},
+  {&base_tex,        "baseTexture",  "BaseTexture",  DEF_BTEX, t_String},
+  {&table_tex,       "tableTexture", "BaseTexture",  DEF_TTEX, t_String},
 };
 
 ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL};
@@ -557,7 +542,7 @@ draw_wing (GLfloat w, GLfloat h, GLfloat d, Bool wire)
   int polys = 0;
   int maxx = coords[0][countof(coords[0])-1][0];
   int maxy = coords[0][countof(coords[0])-1][1];
-  int x;
+  unsigned int x;
 
   for (x = 1; x < countof(coords[0]); x++)
     {
@@ -1267,7 +1252,7 @@ lavalite_handle_event (ModeInfo *mi, XEvent *event)
   lavalite_configuration *bp = &bps[MI_SCREEN(mi)];
 
   if (event->xany.type == ButtonPress &&
-      event->xbutton.button & Button1)
+      event->xbutton.button == Button1)
     {
       bp->button_down_p = True;
       gltrackball_start (bp->trackball,
@@ -1276,11 +1261,19 @@ lavalite_handle_event (ModeInfo *mi, XEvent *event)
       return True;
     }
   else if (event->xany.type == ButtonRelease &&
-           event->xbutton.button & Button1)
+           event->xbutton.button == Button1)
     {
       bp->button_down_p = False;
       return True;
     }
+  else if (event->xany.type == ButtonPress &&
+           (event->xbutton.button == Button4 ||
+            event->xbutton.button == Button5))
+    {
+      gltrackball_mousewheel (bp->trackball, event->xbutton.button, 5,
+                              !!event->xbutton.state);
+      return True;
+    }
   else if (event->xany.type == MotionNotify &&
            bp->button_down_p)
     {
@@ -1298,7 +1291,7 @@ static void
 parse_color (ModeInfo *mi, const char *name, const char *s, GLfloat *a)
 {
   XColor c;
-  a[4] = 1.0;  /* alpha */
+  a[3] = 1.0;  /* alpha */
 
   if (! XParseColor (MI_DISPLAY(mi), MI_COLORMAP(mi), s, &c))
     {