@@ -278,8 +278,11 @@ static void lazy_init(void) {
278
278
backend_inited = true ;
279
279
280
280
NSApp = [NSApplication sharedApplication ];
281
+ [NSApp setActivationPolicy: NSApplicationActivationPolicyRegular];
281
282
282
283
#ifndef PYPY
284
+ /* TODO: remove ifndef after the new PyPy with the PyOS_InputHook implementation
285
+ get released: https://bitbucket.org/pypy/pypy/commits/caaf91a */
283
286
PyOS_InputHook = wait_for_stdin;
284
287
#endif
285
288
@@ -2579,26 +2582,13 @@ static void context_cleanup(const void* info)
2579
2582
Timer_new, /* tp_new */
2580
2583
};
2581
2584
2585
+ #ifndef COMPILING_FOR_10_6
2582
2586
static bool verify_framework (void )
2583
2587
{
2584
2588
ProcessSerialNumber psn;
2585
- /* These methods are deprecated, but they don't require the app to
2586
- have started */
2587
- #ifdef COMPILING_FOR_10_6
2588
- NSApp = [NSApplication sharedApplication ];
2589
- NSApplicationActivationPolicy activationPolicy = [NSApp activationPolicy ];
2590
- switch (activationPolicy) {
2591
- case NSApplicationActivationPolicyRegular:
2592
- case NSApplicationActivationPolicyAccessory:
2593
- return true ;
2594
- case NSApplicationActivationPolicyProhibited:
2595
- break ;
2596
- }
2597
- #else
2598
2589
if (CGMainDisplayID ()!=0
2599
2590
&& GetCurrentProcess (&psn)==noErr
2600
2591
&& SetFrontProcess (&psn)==noErr ) return true ;
2601
- #endif
2602
2592
PyErr_SetString (PyExc_ImportError,
2603
2593
" Python is not installed as a framework. The Mac OS X backend will "
2604
2594
" not be able to function correctly if Python is not installed as a "
@@ -2610,6 +2600,7 @@ static bool verify_framework(void)
2610
2600
" Matplotlib FAQ for more information." );
2611
2601
return false ;
2612
2602
}
2603
+ #endif
2613
2604
2614
2605
static struct PyMethodDef methods[] = {
2615
2606
{" event_loop_is_running" ,
@@ -2660,8 +2651,11 @@ static bool verify_framework(void)
2660
2651
|| PyType_Ready (&TimerType) < 0 )
2661
2652
return NULL ;
2662
2653
2654
+ #ifndef COMPILING_FOR_10_6
2655
+ /* if >=10.6 invoke setActivationPolicy in lazy_init */
2663
2656
if (!verify_framework ())
2664
2657
return NULL ;
2658
+ #endif
2665
2659
2666
2660
module = PyModule_Create (&moduledef);
2667
2661
if (!module)
0 commit comments