http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / hacks / glx / moebius.c
index dcdb0f5e4363e2711a4c53d4f42c4820c3cba485..d05e8c65e3149167c41c11316eff4e921f518e34 100644 (file)
@@ -1,9 +1,8 @@
 /* -*- Mode: C; tab-width: 4 -*- */
 /* moebius --- Moebius Strip II, an Escher-like GL scene with ants. */
 
-#if !defined( lint ) && !defined( SABER )
+#if 0
 static const char sccsid[] = "@(#)moebius.c    5.01 2001/03/01 xlockmore";
-
 #endif
 
 /*-
@@ -116,21 +115,21 @@ static int  noants;
 
 static XrmOptionDescRec opts[] =
 {
-  {(char *) "-solidmoebius", (char *) ".moebius.solidmoebius", XrmoptionNoArg, (caddr_t) "on"},
-  {(char *) "+solidmoebius", (char *) ".moebius.solidmoebius", XrmoptionNoArg, (caddr_t) "off"},
-  {(char *) "-noants", (char *) ".moebius.noants", XrmoptionNoArg, (caddr_t) "on"},
-  {(char *) "+noants", (char *) ".moebius.noants", XrmoptionNoArg, (caddr_t) "off"}
+  {"-solidmoebius", ".moebius.solidmoebius", XrmoptionNoArg, "on"},
+  {"+solidmoebius", ".moebius.solidmoebius", XrmoptionNoArg, "off"},
+  {"-noants", ".moebius.noants", XrmoptionNoArg, "on"},
+  {"+noants", ".moebius.noants", XrmoptionNoArg, "off"}
 };
 static argtype vars[] =
 {
-  {(caddr_t *) & solidmoebius, (char *) "solidmoebius", (char *) "Solidmoebius", (char *) DEF_SOLIDMOEBIUS, t_Bool},
-  {(caddr_t *) & noants, (char *) "noants", (char *) "Noants", (char *) DEF_NOANTS, t_Bool}
+  {&solidmoebius, "solidmoebius", "Solidmoebius", DEF_SOLIDMOEBIUS, t_Bool},
+  {&noants, "noants", "Noants", DEF_NOANTS, t_Bool}
 
 };
 static OptionStruct desc[] =
 {
-       {(char *) "-/+solidmoebius", (char *) "select between a SOLID or a NET Moebius Strip"},
-       {(char *) "-/+noants", (char *) "turn on/off walking ants"}
+       {"-/+solidmoebius", "select between a SOLID or a NET Moebius Strip"},
+       {"-/+noants", "turn on/off walking ants"}
 };
 
 ModeSpecOpt moebius_opts =
@@ -608,7 +607,7 @@ pinit(void)
                                GL_RGB, GL_UNSIGNED_BYTE, WoodTextureData);
     if (status)
       {
-        const char *s = gluErrorString (status);
+        const char *s = (char *) gluErrorString (status);
         fprintf (stderr, "%s: error mipmapping %dx%d texture: %s\n",
                  progname, WoodTextureWidth, WoodTextureHeight,
                  (s ? s : "(unknown)"));
@@ -644,7 +643,7 @@ moebius_handle_event (ModeInfo *mi, XEvent *event)
   moebiusstruct *mp = &moebius[MI_SCREEN(mi)];
 
   if (event->xany.type == ButtonPress &&
-      event->xbutton.button & Button1)
+      event->xbutton.button == Button1)
     {
       mp->button_down_p = True;
       gltrackball_start (mp->trackball,
@@ -653,11 +652,19 @@ moebius_handle_event (ModeInfo *mi, XEvent *event)
       return True;
     }
   else if (event->xany.type == ButtonRelease &&
-           event->xbutton.button & Button1)
+           event->xbutton.button == Button1)
     {
       mp->button_down_p = False;
       return True;
     }
+  else if (event->xany.type == ButtonPress &&
+           (event->xbutton.button == Button4 ||
+            event->xbutton.button == Button5))
+    {
+      gltrackball_mousewheel (mp->trackball, event->xbutton.button, 10,
+                              !!event->xbutton.state);
+      return True;
+    }
   else if (event->xany.type == MotionNotify &&
            mp->button_down_p)
     {