http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / hacks / glx / glblur.c
index 5504e39b92d0d47de88f3538f448d14ffb76cf7c..9395d7c6997771dd0bf788f37b187a47153e9265 100644 (file)
@@ -1,5 +1,5 @@
 /* glblur --- radial blur using GL textures
- * Copyright (c) 2002 Jamie Zawinski <jwz@jwz.org>
+ * 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
@@ -115,9 +115,9 @@ static XrmOptionDescRec opts[] = {
 };
 
 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 *) &blursize,  "blurSize","BlurSize", DEF_BLURSIZE,  t_Int},
+  {&do_spin,   "spin",   "Spin",   DEF_SPIN,   t_String},
+  {&do_wander, "wander", "Wander", DEF_WANDER, t_Bool},
+  {&blursize,  "blurSize","BlurSize", DEF_BLURSIZE,  t_Int},
 };
 
 ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL};
@@ -258,7 +258,10 @@ init_texture (ModeInfo *mi)
   glGenTextures (1, &bp->texture);
   glBindTexture (GL_TEXTURE_2D, bp->texture);
   glTexImage2D (GL_TEXTURE_2D, 0, 4, 128, 128, 0,
-               GL_RGBA, GL_UNSIGNED_BYTE, bp->tex_data);
+               GL_RGBA,
+                /* GL_UNSIGNED_BYTE, */
+                GL_UNSIGNED_INT_8_8_8_8_REV,
+                bp->tex_data);
   glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
   glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 }
@@ -360,7 +363,7 @@ glblur_handle_event (ModeInfo *mi, XEvent *event)
   glblur_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->trackball,
@@ -369,11 +372,19 @@ glblur_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->trackball, event->xbutton.button, 10,
+                              !!event->xbutton.state);
+      return True;
+    }
   else if (event->xany.type == MotionNotify &&
            bp->button_down_p)
     {