http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / hacks / glx / endgame.c
index 41131c28d325c032fa3879becbd0c04127e5fc8b..4393a6783f6a659e12fd6ff6dd4422acc1b3f428 100644 (file)
 #define countof(x) (sizeof((x))/sizeof((*x)))
 
 static XrmOptionDescRec opts[] = {
-  {"+rotate", ".chess.rotate", XrmoptionNoArg, (caddr_t) "false" },
-  {"-rotate", ".chess.rotate", XrmoptionNoArg, (caddr_t) "true" },
-  {"+reflections", ".chess.reflections", XrmoptionNoArg, (caddr_t) "false" },
-  {"-reflections", ".chess.reflections", XrmoptionNoArg, (caddr_t) "true" },
-  {"+shadows", ".chess.shadows", XrmoptionNoArg, (caddr_t) "false" },
-  {"-shadows", ".chess.shadows", XrmoptionNoArg, (caddr_t) "true" },
-  {"+smooth", ".chess.smooth", XrmoptionNoArg, (caddr_t) "false" },
-  {"-smooth", ".chess.smooth", XrmoptionNoArg, (caddr_t) "true" },
+  {"+rotate", ".chess.rotate", XrmoptionNoArg, "false" },
+  {"-rotate", ".chess.rotate", XrmoptionNoArg, "true" },
+  {"+reflections", ".chess.reflections", XrmoptionNoArg, "false" },
+  {"-reflections", ".chess.reflections", XrmoptionNoArg, "true" },
+  {"+shadows", ".chess.shadows", XrmoptionNoArg, "false" },
+  {"-shadows", ".chess.shadows", XrmoptionNoArg, "true" },
+  {"+smooth", ".chess.smooth", XrmoptionNoArg, "false" },
+  {"-smooth", ".chess.smooth", XrmoptionNoArg, "true" },
 };
 
 int rotate, reflections, smooth, shadows;
@@ -206,7 +206,7 @@ double theta = 0.0;
 Bool chess_handle_event (ModeInfo *mi, XEvent *event) {
   Chesscreen *c = &qs[MI_SCREEN(mi)];
 
-  if(event->xany.type == ButtonPress && event->xbutton.button & Button1) {
+  if(event->xany.type == ButtonPress && event->xbutton.button == Button1) {
     c->button_down_p = True;
     gltrackball_start (c->trackball,
                       event->xbutton.x, event->xbutton.y,
@@ -214,10 +214,18 @@ Bool chess_handle_event (ModeInfo *mi, XEvent *event) {
     return True;
   }
   else if(event->xany.type == ButtonRelease 
-         && event->xbutton.button & Button1) {
+         && event->xbutton.button == Button1) {
     c->button_down_p = False;
     return True;
   }
+  else if (event->xany.type == ButtonPress &&
+           (event->xbutton.button == Button4 ||
+            event->xbutton.button == Button5))
+    {
+      gltrackball_mousewheel (c->trackball, event->xbutton.button, 5,
+                              !event->xbutton.state);
+      return True;
+    }
   else if(event->xany.type == MotionNotify && c->button_down_p) {
     gltrackball_track (c->trackball,
                       event->xmotion.x, event->xmotion.y,