Added eventhandling in mainloop/busywait routine plus leaving some
cycles for background apps. MacOS has a new method to set the amount
of time for bg apps.
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c
index 7fb069c..6c274e8 100644
--- a/Mac/Modules/macosmodule.c
+++ b/Mac/Modules/macosmodule.c
@@ -107,6 +107,8 @@
}
}
+/* XXXX Need to come here from PyMac_DoYield too... */
+
static PyObject *
MacOS_SetHighLevelEventHandler(self, args)
PyObject *self;
@@ -166,6 +168,26 @@
return res;
}
+/*
+** Set poll frequency and cpu-yield-time
+*/
+static PyObject *
+MacOS_SetScheduleTimes(PyObject *self, PyObject *args)
+{
+ long fgi, fgy, bgi, bgy;
+
+ bgi = bgy = -2;
+ if (!PyArg_ParseTuple(args, "ll|ll", &fgi, &fgy, &bgi, &bgy))
+ return NULL;
+ if ( bgi == -2 ) {
+ bgi = fgi;
+ bgy = fgy;
+ }
+ PyMac_SetYield(fgi, fgy, bgi, bgy);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyMethodDef MacOS_Methods[] = {
{"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1},
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1},
@@ -173,6 +195,7 @@
#ifdef USE_STDWIN
{"SetHighLevelEventHandler", MacOS_SetHighLevelEventHandler, 1},
#endif
+ {"SetScheduleTimes", MacOS_SetScheduleTimes, 1},
{NULL, NULL} /* Sentinel */
};