Thanks! I applied both of your fixes to the ctypes clone.
(Though on my end I still can't get anything to run in
PyPy 1.6.  It gives me an "unknown shape" assertion
error during a call to CFStringGetCString.  I might try the
newer version later today and see if that fixes anything. )

--phillip

On Nov 22, 12:17 am, Tristam MacDonald <[email protected]> wrote:
> On Mon, Nov 21, 2011 at 7:39 PM, Tristam MacDonald 
> <[email protected]>wrote:
>
> > I can't seem to get pypy to pickup keyboard events - the pyglet window
> > isn't managing to take focus away from the terminal window. The fix for
> > this is to run from within an App bundle (or pretend to, as the system
> > 'pythonw' does), but that part of my original Cocoa port doesn't seem to
> > have survived the development process.
>
> Aha! I finally found the post-Snow Leopard solution to this problem, in the
> form of the little-known [NSApplication setActivationPolicy:
> NSApplicationActivationPolicyRegular<http://developer.apple.com/library/mac/documentation/AppKit/Reference...>]
> method.
>
> This method is unavailable pre-Snow Leopard. Is a Cocoa backend pre-Snow
> Leopard possible or desirable? Do we need to special case this for older OS
> versions?
>
> Simplistic patch against the evilphillip-cocoa-ctypes repository is as
> follows:
>
> ========================================================
> diff -r acee3bdb3b9d pyglet/app/cocoa.py
> --- a/pyglet/app/cocoa.py Mon Nov 21 19:28:22 2011 -0500
> +++ b/pyglet/app/cocoa.py Tue Nov 22 01:05:16 2011 -0500
> @@ -76,6 +76,7 @@
>          # Create an autorelease pool for menu creation and finishLaunching
>          self.pool = alloc_init('NSAutoreleasePool')
>          create_menu()
> +        send_message(self.NSApp, 'setActivationPolicy:', 0)
>          send_message(self.NSApp, 'finishLaunching')
>          send_message(self.NSApp, 'activateIgnoringOtherApps:', True)
>          #send_message(self.pool, 'drain')
> ========================================================
>
> --
> Tristam MacDonald
> System Administrator, Suffolk University Math & CS 
> Departmenthttp://swiftcoder.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to