http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / hacks / glx / flyingtoasters.c
index 5efc529f13fa4e6b4c4fd07264d997018ca52011..31563189af84bdfc919408b7d57fa8ff751e97e5 100644 (file)
@@ -1,4 +1,4 @@
-/* flyingtoasters, Copyright (c) 2003 Jamie Zawinski <jwz@jwz.org>
+/* flyingtoasters, Copyright (c) 2003, 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
@@ -153,15 +153,15 @@ static XrmOptionDescRec opts[] = {
   { "-speed",  ".speed",  XrmoptionSepArg, 0 },
   { "-ntoasters",  ".ntoasters", XrmoptionSepArg, 0 },
   { "-nslices",    ".nslices",   XrmoptionSepArg, 0 },
-  {"-texture",     ".texture",   XrmoptionNoArg, (caddr_t) "True" },
-  {"+texture",     ".texture",   XrmoptionNoArg, (caddr_t) "False" },
+  {"-texture",     ".texture",   XrmoptionNoArg, "True" },
+  {"+texture",     ".texture",   XrmoptionNoArg, "False" },
 };
 
 static argtype vars[] = {
-  {(caddr_t *) &speed,      "speed",      "Speed",   DEF_SPEED,     t_Float},
-  {(caddr_t *) &ntoasters,  "ntoasters",  "Count",   DEF_NTOASTERS, t_Int},
-  {(caddr_t *) &nslices,    "nslices",    "Count",   DEF_NSLICES,   t_Int},
-  {(caddr_t *) &do_texture, "texture",    "Texture", DEF_TEXTURE,   t_Bool},
+  {&speed,      "speed",      "Speed",   DEF_SPEED,     t_Float},
+  {&ntoasters,  "ntoasters",  "Count",   DEF_NTOASTERS, t_Int},
+  {&nslices,    "nslices",    "Count",   DEF_NSLICES,   t_Int},
+  {&do_texture, "texture",    "Texture", DEF_TEXTURE,   t_Bool},
 };
 
 ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL};
@@ -324,7 +324,7 @@ toaster_handle_event (ModeInfo *mi, XEvent *event)
   toaster_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->user_trackball,
@@ -333,11 +333,19 @@ toaster_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->user_trackball, event->xbutton.button, 5,
+                              !event->xbutton.state);
+      return True;
+    }
   else if (event->xany.type == MotionNotify &&
            bp->button_down_p)
     {