[pyglet] push by evil.phillip@gmail.com - disable persistent window state which prevented new windows from displ... on 2012-12-07 20:30 GMT

5 views
Skip to first unread message

pyg...@googlecode.com

unread,
Dec 7, 2012, 3:30:23 PM12/7/12
to pyglet-...@googlegroups.com
Revision: 1ca236a64db0
Branch: default
Author: Phillip Nguyen <evil.p...@gmail.com>
Date: Fri Dec 7 12:29:36 2012
Log: disable persistent window state which prevented new windows from
displaying
after finishLaunching on 10.8
http://code.google.com/p/pyglet/source/detail?r=1ca236a64db0

Modified:
/pyglet/app/cocoa.py

=======================================
--- /pyglet/app/cocoa.py Thu Oct 11 17:32:01 2012
+++ /pyglet/app/cocoa.py Fri Dec 7 12:29:36 2012
@@ -46,6 +46,7 @@
NSAutoreleasePool = ObjCClass('NSAutoreleasePool')
NSDate = ObjCClass('NSDate')
NSEvent = ObjCClass('NSEvent')
+NSUserDefaults = ObjCClass('NSUserDefaults')

def add_menu_item(menu, title, action, key):
title = CFSTR(title)
@@ -91,6 +92,13 @@
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("ApplerPersistenceIgnoreState")
+ if not defaults.objectForKey_(ignoreState):
+ defaults.setBool_forKey_(True, ignoreState)

def start(self):
self.NSApp.finishLaunching()
Reply all
Reply to author
Forward
0 new messages