ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.21.tar.gz
[xscreensaver] / hacks / glx / jigglypuff.c
index ae8891f739cb743dc95a68e7a8c38afba8b2ea68..b93b6446be3fb8b83842e87eb4f282e915f7a02d 100644 (file)
 # define DEFAULTS           "*delay: 20000\n" \
                             "*showFPS: False\n" \
                             "*wireframe: False\n" \
-                            "*color: cycle\n" \
-                            "*shininess: 100\n" \
-                            "*complexity: 2\n" \
-                            "*speed: 500\n" \
-                            "*distance: 100\n" \
-                            "*hold: 800\n" \
-                            "*spherism: 200\n" \
-                            "*damping: 500\n"
-
 
 # include "xlockmore.h"
 #else
@@ -138,33 +129,33 @@ typedef struct {
 static jigglystruct *jss = NULL;
 
 static XrmOptionDescRec opts[] = {
-    {"-random", ".Jigglypuff.random", XrmoptionNoArg, (caddr_t)"true"},
-    {"+random", ".Jigglypuff.random", XrmoptionNoArg, (caddr_t)"false"},
-    {"-tetra", ".Jigglypuff.tetra", XrmoptionNoArg, (caddr_t)"true"},
-    {"+tetra", ".Jigglypuff.tetra", XrmoptionNoArg, (caddr_t)"false"},
-    {"-spooky", ".Jigglypuff.spooky", XrmoptionSepArg, (caddr_t)"0"},
-    {"-color", ".Jigglypuff.color", XrmoptionSepArg, (caddr_t)DEF_COLOR},
-    {"-shininess", ".Jigglypuff.shininess", XrmoptionSepArg, (caddr_t)DEF_SHININESS},
-    {"-complexity", ".Jigglypuff.complexity", XrmoptionSepArg, (caddr_t)DEF_COMPLEXITY},
-    {"-speed", ".Jigglypuff.speed", XrmoptionSepArg, (caddr_t)DEF_SPEED},
-    {"-spherism", ".Jigglypuff.spherism", XrmoptionSepArg, (caddr_t)DEF_SPHERISM},
-    {"-hold", ".Jigglypuff.hold", XrmoptionSepArg, (caddr_t)DEF_HOLD},
-    {"-distance", "Jigglypuff.distance", XrmoptionSepArg, (caddr_t)DEF_DISTANCE},
-    {"-damping", "Jigglypuff.damping", XrmoptionSepArg, (caddr_t)DEF_DAMPING}
+    {"-random", ".Jigglypuff.random", XrmoptionNoArg, "true"},
+    {"+random", ".Jigglypuff.random", XrmoptionNoArg, "false"},
+    {"-tetra", ".Jigglypuff.tetra", XrmoptionNoArg, "true"},
+    {"+tetra", ".Jigglypuff.tetra", XrmoptionNoArg, "false"},
+    {"-spooky", ".Jigglypuff.spooky", XrmoptionSepArg, "0"},
+    {"-color", ".Jigglypuff.color", XrmoptionSepArg, DEF_COLOR},
+    {"-shininess", ".Jigglypuff.shininess", XrmoptionSepArg, DEF_SHININESS},
+    {"-complexity", ".Jigglypuff.complexity", XrmoptionSepArg, DEF_COMPLEXITY},
+    {"-speed", ".Jigglypuff.speed", XrmoptionSepArg, DEF_SPEED},
+    {"-spherism", ".Jigglypuff.spherism", XrmoptionSepArg, DEF_SPHERISM},
+    {"-hold", ".Jigglypuff.hold", XrmoptionSepArg, DEF_HOLD},
+    {"-distance", "Jigglypuff.distance", XrmoptionSepArg, DEF_DISTANCE},
+    {"-damping", "Jigglypuff.damping", XrmoptionSepArg, DEF_DAMPING}
 };
 
 static argtype vars[] = {
-    {(caddr_t*)&random_parms, "random", "Random", "False", t_Bool},
-    {(caddr_t*)&do_tetrahedron, "tetra", "Tetra", "False", t_Bool},
-    {(caddr_t*)&spooky, "spooky", "Spooky", "0", t_Int},
-    {(caddr_t*)&color, "color", "Color", DEF_COLOR, t_String},
-    {(caddr_t*)&shininess, "shininess", "Shininess", DEF_SHININESS, t_Int},
-    {(caddr_t*)&complexity, "complexity", "Complexity", DEF_COMPLEXITY, t_Int},
-    {(caddr_t*)&speed, "speed", "Speed", DEF_SPEED, t_Int},
-    {(caddr_t*)&spherism, "spherism", "Spherism", DEF_SPHERISM, t_Int},
-    {(caddr_t*)&hold, "hold", "Hold", DEF_HOLD, t_Int},
-    {(caddr_t*)&distance, "distance", "Distance", DEF_DISTANCE, t_Int},
-    {(caddr_t*)&damping, "damping", "Damping", DEF_DAMPING, t_Int}
+    {&random_parms, "random", "Random", "False", t_Bool},
+    {&do_tetrahedron, "tetra", "Tetra", "False", t_Bool},
+    {&spooky, "spooky", "Spooky", "0", t_Int},
+    {&color, "color", "Color", DEF_COLOR, t_String},
+    {&shininess, "shininess", "Shininess", DEF_SHININESS, t_Int},
+    {&complexity, "complexity", "Complexity", DEF_COMPLEXITY, t_Int},
+    {&speed, "speed", "Speed", DEF_SPEED, t_Int},
+    {&spherism, "spherism", "Spherism", DEF_SPHERISM, t_Int},
+    {&hold, "hold", "Hold", DEF_HOLD, t_Int},
+    {&distance, "distance", "Distance", DEF_DISTANCE, t_Int},
+    {&damping, "damping", "Damping", DEF_DAMPING, t_Int}
 };
 
 #undef countof
@@ -931,17 +922,25 @@ Bool jigglypuff_handle_event(ModeInfo *mi, XEvent *event)
     jigglystruct *js = &jss[MI_SCREEN(mi)];
     
     if(event->xany.type == ButtonPress &&
-       event->xbutton.button & Button1) {
+       event->xbutton.button == Button1) {
        js->button_down = 1;
        gltrackball_start(js->trackball, event->xbutton.x, event->xbutton.y,
                          MI_WIDTH(mi), MI_HEIGHT(mi));
        return True;
     }
     else if(event->xany.type == ButtonRelease &&
-           event->xbutton.button & Button1) {
+           event->xbutton.button == Button1) {
        js->button_down = 0;
        return True;
     }
+  else if (event->xany.type == ButtonPress &&
+           (event->xbutton.button == Button4 ||
+            event->xbutton.button == Button5))
+    {
+      gltrackball_mousewheel (js->trackball, event->xbutton.button, 10,
+                              !!event->xbutton.state);
+      return True;
+    }
     else if(event->xany.type == MotionNotify && js->button_down) {
        gltrackball_track(js->trackball, event->xmotion.x, event->xmotion.y,
                          MI_WIDTH(mi), MI_HEIGHT(mi));