http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / hacks / glx / cubenetic.c
index a7399dd17a3bc26a658c77b6a24a8f3b3ec754db..44f2b73f9b9e28f6726dee966840a9c1195d82c5 100644 (file)
@@ -1,4 +1,4 @@
-/* cubenetic, Copyright (c) 2002, 2003 Jamie Zawinski <jwz@jwz.org>
+/* cubenetic, 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
@@ -29,7 +29,7 @@ extern XtAppContext app;
 #define DEF_WAVE_SPEED  "80"
 #define DEF_WAVE_RADIUS "512"
 
-#define DEFAULTS       "*delay:        30000       \n" \
+#define DEFAULTS       "*delay:        20000       \n" \
                        "*count:        5           \n" \
                        "*showFPS:      False       \n" \
                        "*wireframe:    False       \n" \
@@ -113,20 +113,20 @@ static XrmOptionDescRec opts[] = {
   { "+spin",   ".spin",   XrmoptionNoArg, "" },
   { "-wander", ".wander", XrmoptionNoArg, "True" },
   { "+wander", ".wander", XrmoptionNoArg, "False" },
-  {"-texture", ".texture", XrmoptionNoArg, (caddr_t) "true" },
-  {"+texture", ".texture", XrmoptionNoArg, (caddr_t) "false" },
+  {"-texture", ".texture", XrmoptionNoArg, "true" },
+  {"+texture", ".texture", XrmoptionNoArg, "false" },
   {"-waves",       ".waves",      XrmoptionSepArg, 0 },
   {"-wave-speed",  ".waveSpeed",  XrmoptionSepArg, 0 },
   {"-wave-radius", ".waveRadius", XrmoptionSepArg, 0 },
 };
 
 static argtype vars[] = {
-  {(caddr_t *) &do_spin,   "spin",   "Spin",   DEF_SPIN,   t_String},
-  {(caddr_t *) &do_wander, "wander", "Wander", DEF_WANDER, t_Bool},
-  {(caddr_t *) &do_texture, "texture", "Texture", DEF_TEXTURE, t_Bool},
-  {(caddr_t *) &wave_count, "waves",     "Waves",      DEF_WAVE_COUNT, t_Int},
-  {(caddr_t *) &wave_speed, "waveSpeed", "WaveSpeed",  DEF_WAVE_SPEED, t_Int},
-  {(caddr_t *) &wave_radius,"waveRadius","WaveRadius", DEF_WAVE_RADIUS,t_Int},
+  {&do_spin,   "spin",   "Spin",   DEF_SPIN,   t_String},
+  {&do_wander, "wander", "Wander", DEF_WANDER, t_Bool},
+  {&do_texture, "texture", "Texture", DEF_TEXTURE, t_Bool},
+  {&wave_count, "waves",     "Waves",      DEF_WAVE_COUNT, t_Int},
+  {&wave_speed, "waveSpeed", "WaveSpeed",  DEF_WAVE_SPEED, t_Int},
+  {&wave_radius,"waveRadius","WaveRadius", DEF_WAVE_RADIUS,t_Int},
 };
 
 ModeSpecOpt ccs_opts = {countof(opts), opts, countof(vars), vars, NULL};
@@ -349,7 +349,7 @@ cube_handle_event (ModeInfo *mi, XEvent *event)
   cube_configuration *cc = &ccs[MI_SCREEN(mi)];
 
   if (event->xany.type == ButtonPress &&
-      event->xbutton.button & Button1)
+      event->xbutton.button == Button1)
     {
       cc->button_down_p = True;
       gltrackball_start (cc->trackball,
@@ -358,11 +358,19 @@ cube_handle_event (ModeInfo *mi, XEvent *event)
       return True;
     }
   else if (event->xany.type == ButtonRelease &&
-           event->xbutton.button & Button1)
+           event->xbutton.button == Button1)
     {
       cc->button_down_p = False;
       return True;
     }
+  else if (event->xany.type == ButtonPress &&
+           (event->xbutton.button == Button4 ||
+            event->xbutton.button == Button5))
+    {
+      gltrackball_mousewheel (cc->trackball, event->xbutton.button, 10,
+                              !!event->xbutton.state);
+      return True;
+    }
   else if (event->xany.type == MotionNotify &&
            cc->button_down_p)
     {