http://www.tienza.es/crux/src/www.jwz.org/xscreensaver/xscreensaver-5.06.tar.gz
[xscreensaver] / OSX / XScreenSaverView.m
index 2d60982d4e69b6355084b79ab12f11b9bb3a2c7b..2baf2c69f9e3575cc026671e2d44f2b5e8e5147d 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 2006 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 2006, 2007 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
@@ -313,7 +313,18 @@ add_default_options (const XrmOptionDescRec *opts,
     XClearWindow (xdpy, xwindow);
     
     [[self window] setAcceptsMouseMovedEvents:YES];
-    
+
+    /* In MacOS 10.5, this enables "QuartzGL", meaning that the Quartz
+       drawing primitives will run on the GPU instead of the CPU.
+       It seems like it might make things worse rather than better,
+       though...  Plus it makes us binary-incompatible with 10.4.
+
+# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+    [[self window] setPreferredBackingLocation:
+                     NSWindowBackingLocationVideoMemory];
+# endif
+     */
+
     /* Kludge: even though the init_cb functions are declared to take 2 args,
       actually call them with 3, for the benefit of xlockmore_init() and
       xlockmore_setup().
@@ -373,10 +384,11 @@ add_default_options (const XrmOptionDescRec *opts,
 
   // And finally:
   //
+  NSDisableScreenUpdates();
   unsigned long delay = xsft->draw_cb (xdpy, xwindow, xdata);
-  
   XSync (xdpy, 0);
-  
+  NSEnableScreenUpdates();
+
   gettimeofday (&tv, 0);
   now = tv.tv_sec + (tv.tv_usec / 1000000.0);
   next_frame_time = now + (delay / 1000000.0);
@@ -488,7 +500,11 @@ add_default_options (const XrmOptionDescRec *opts,
       xe.xbutton.y = y;
       xe.xbutton.state = state;
       if ([e type] == NSScrollWheel)
-        xe.xbutton.button = ([e deltaY] > 0 ? Button4 : Button5);
+        xe.xbutton.button = ([e deltaY] > 0 ? Button4 :
+                             [e deltaY] < 0 ? Button5 :
+                             [e deltaX] > 0 ? Button6 :
+                             [e deltaX] < 0 ? Button7 :
+                             0);
       else
         xe.xbutton.button = [e buttonNumber] + 1;
       break;