Commits

Adam Bark  committed 3888a25 Merge

Merge latest changes from googlecode.

  • Participants
  • Parent commits c90f75f, d0207cb

Comments (0)

Files changed (9)

 syntax: glob
 *.pyc
 *.pyo
-build
+_build
 pyglet.*.log
 *.orig
 .DS_Store
 doc/api
-doc/_build
 doc/internal/build.rst
 website/dist
+build

File pyglet/app/cocoa.py

 NSAutoreleasePool = ObjCClass('NSAutoreleasePool')
 NSDate = ObjCClass('NSDate')
 NSEvent = ObjCClass('NSEvent')
+NSUserDefaults = ObjCClass('NSUserDefaults')
 
 def add_menu_item(menu, title, action, key):
     title = CFSTR(title)
         self.pool = NSAutoreleasePool.alloc().init()
         create_menu()
         self.NSApp.setActivationPolicy_(NSApplicationActivationPolicyRegular)
+        # Prevent Lion / Mountain Lion from automatically saving application state.
+        # If we don't do this, new windows will not display on 10.8 after finishLaunching
+        # has been called.  
+        defaults = NSUserDefaults.standardUserDefaults()
+        ignoreState = CFSTR("ApplePersistenceIgnoreState")
+        if not defaults.objectForKey_(ignoreState):
+            defaults.setBool_forKey_(True, ignoreState)
 
     def start(self):
         self.NSApp.finishLaunching()

File pyglet/input/darwin_hid.py

 iokit.IOHIDValueGetIntegerValue.restype = CFIndex
 iokit.IOHIDValueGetIntegerValue.argtypes = [c_void_p]
 
+iokit.IOHIDValueGetLength.restype = CFIndex
+iokit.IOHIDValueGetLength.argtypes = [c_void_p]
+
 iokit.IOHIDValueGetTimeStamp.restype = c_uint64
 iokit.IOHIDValueGetTimeStamp.argtypes = [c_void_p]
 
         assert(cf.CFGetTypeID(valueRef) == iokit.IOHIDValueGetTypeID())
         self.valueRef = valueRef
         self.timestamp = iokit.IOHIDValueGetTimeStamp(valueRef)
-        self.intvalue = iokit.IOHIDValueGetIntegerValue(valueRef)
+        self.length = iokit.IOHIDValueGetLength(valueRef)
+        if self.length <= 4:
+            self.intvalue = iokit.IOHIDValueGetIntegerValue(valueRef)
+        else:
+            # Values may be byte data rather than integers.
+            # e.g. the PS3 controller has a 39-byte HIDValue element.
+            # We currently do not try to handle these cases.
+            self.intvalue = None
         elementRef = c_void_p(iokit.IOHIDValueGetElement(valueRef))
         self.element = HIDDeviceElement.get_element(elementRef)
 

File pyglet/libs/win32/__init__.py

 #!/usr/bin/python
 # $Id: $
 
+import struct
 from ctypes import *
 
 import pyglet
 import constants
 from types import *
 
+IS64 = struct.calcsize("P") == 8
+
 _debug_win32 = pyglet.options['debug_win32']
 
 if _debug_win32:
 _user32.SetCapture.argtypes = [HWND]
 _user32.SetClassLongW.restype = DWORD
 _user32.SetClassLongW.argtypes = [HWND, c_int, LONG]
-if tuple.__itemsize__ == 8:
+if IS64:
     _user32.SetClassLongPtrW.restype = ULONG
     _user32.SetClassLongPtrW.argtypes = [HWND, c_int, LONG_PTR]
 else:

File pyglet/resource.py

         self._script_home = script_home
         self._index = None
 
-        # Map name to image
-        self._cached_textures = weakref.WeakValueDictionary()
-        self._cached_images = weakref.WeakValueDictionary()
-        self._cached_animations = weakref.WeakValueDictionary()
-
         # Map bin size to list of atlases
         self._texture_atlas_bins = {}
 
         You must call this method if `path` is changed or the filesystem
         layout changes.
         '''
+        # map name to image etc.
         self._cached_textures = weakref.WeakValueDictionary()
         self._cached_images = weakref.WeakValueDictionary()
         self._cached_animations = weakref.WeakValueDictionary()
+
         self._index = {}
         for path in self.path:
             if path.startswith('@'):

File pyglet/window/cocoa/__init__.py

             self._nswindow.setLevel_(quartz.CGShieldingWindowLevel())
             self.context.set_full_screen()
             self._center_window()
+            self._mouse_in_window = True
         else:
             self._set_nice_window_location()
+            self._mouse_in_window = self._mouse_in_content_rect()
 
         # Then create a view and set it as our NSWindow's content view.
         self._nsview = PygletView.alloc().initWithFrame_cocoaWindow_(content_rect, self)

File pyglet/window/cocoa/pyglet_view.py

 
 def getMouseDelta(nsevent):
     dx = nsevent.deltaX()
-    dy = nsevent.deltaY()
-    return int(dx), int(dy)
+    dy = -nsevent.deltaY()
+    return int(round(dx)), int(round(dy))
 
 def getMousePosition(self, nsevent):
     in_window = nsevent.locationInWindow()
         'pyglet.window.win32',
         'pyglet.window.xlib',
     ],
+
+    # Add _ prefix to the names of temporary build dirs
+    options={
+        'build': {'build_base': '_build'},
+        'sdist': {'dist_dir': '_dist'},
+    }
 )
 
 setuptools_info = dict(

File tests/test.py

     only includes your operating system capability (X11, WIN or OSX) and
     GENERIC.
 `--log-level=`
-    Specify the minimum log level to write (defaults to 10: info)
+    Specify the minimum log level to write (defaults to 20: info)
 
 `--log-file=`
     Specify log file to write to (defaults to "pyglet.%d.log")
     op.add_option('--capabilities', help='selected test capabilities',
         default=','.join(capabilities))
     op.add_option('--log-level', help='verbosity of logging',
-        default=10, type='int')
+        default=20, type='int')
     op.add_option('--log-file', help='log to FILE', metavar='FILE', 
         default='pyglet.%d.log')
     op.add_option('--regression-path', metavar='DIR', default=regressions_path,