File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,13 +197,13 @@ MacOS_SetScheduleTimes(PyObject *self, PyObject *args)
197197static PyObject *
198198MacOS_EnableAppswitch (PyObject * self , PyObject * args )
199199{
200- int enable ;
200+ int old , new ;
201201
202- if (!PyArg_ParseTuple (args , "i" , & enable ))
202+ if (!PyArg_ParseTuple (args , "i" , & new ))
203203 return NULL ;
204- PyMac_DoYieldEnabled = enable ;
205- Py_INCREF ( Py_None ) ;
206- return Py_None ;
204+ old = PyMac_DoYieldEnabled ;
205+ PyMac_DoYieldEnabled = new ;
206+ return Py_BuildValue ( "i" , old ) ;
207207}
208208
209209
@@ -246,3 +246,4 @@ MacOS_Init()
246246 if (MacOS_Error == NULL || PyDict_SetItemString (d , "Error" , MacOS_Error ) != 0 )
247247 Py_FatalError ("can't define MacOS.Error" );
248248}
249+
Original file line number Diff line number Diff line change @@ -115,7 +115,12 @@ static long yield_bg = 12;
115115static long lastyield ;
116116static int in_foreground ;
117117
118- int PyMac_DoYieldEnabled = 1 ; /* Don't do eventloop when false */
118+ /*
119+ ** When > 0, do full scanning for events (program is not event aware)
120+ ** when == 0, only scan for Command-period
121+ ** when < 0, don't do any event scanning
122+ */
123+ int PyMac_DoYieldEnabled = 1 ;
119124
120125/* Convert C to Pascal string. Returns pointer to static buffer. */
121126unsigned char *
@@ -238,6 +243,8 @@ scan_event_queue(flush)
238243int
239244PyOS_InterruptOccurred ()
240245{
246+ if (PyMac_DoYieldEnabled < 0 )
247+ return 0 ;
241248#ifdef THINK_C
242249 scan_event_queue (1 );
243250#endif
@@ -882,3 +889,4 @@ PyMac_InitApplication()
882889 }
883890 Py_Main (argc , argv );
884891}
892+
You can’t perform that action at this time.
0 commit comments