ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.21.tar.gz
[xscreensaver] / hacks / glx / endgame.c
index 41131c28d325c032fa3879becbd0c04127e5fc8b..30f4e7dfff067a501050382fc7b2cddd99e685b8 100644 (file)
 # define EVENT_MASK       PointerMotionMask
 # define chess_opts  xlockmore_opts
 
-#define DEFAULTS       "*delay:       20000       \n" \
-                       "*showFPS:       False       \n" \
-                      "*wireframe:     False     \n"   \
-                      "*reflections:   True     \n"    \
-                      "*shadows:       True     \n"    \
+#define DEFAULTS       "*delay:     20000 \n" \
+                       "*showFPS:   False \n" \
+                      "*wireframe: False \n" \
 
 # include "xlockmore.h"
 
 #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 +204,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 +212,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,