summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/carbonevt/CarbonEvtsupport.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules/carbonevt/CarbonEvtsupport.py')
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtsupport.py56
1 files changed, 1 insertions, 55 deletions
diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py
index 19d7d6d..3cc1672 100644
--- a/Mac/Modules/carbonevt/CarbonEvtsupport.py
+++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py
@@ -73,26 +73,9 @@ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
MouseTrackingResult = UInt16
-includestuff = r"""
+includestuff = includestuff + r"""
#include <Carbon/Carbon.h>
-#include "macglue.h"
-
-/* Macro to test whether a weak-loaded CFM function exists */
-#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
- PyErr_SetString(PyExc_NotImplementedError, \
- "Not available in this shared library/OS version"); \
- return; \
- }} while(0)
-
-
-#define USE_MAC_MP_MULTITHREADING 0
-
-#if USE_MAC_MP_MULTITHREADING
-static PyThreadState *_save;
-static MPCriticalRegionID reentrantLock;
-#endif /* USE_MAC_MP_MULTITHREADING */
-
extern int CFStringRef_New(CFStringRef *);
extern int CFStringRef_Convert(PyObject *, CFStringRef *);
@@ -168,11 +151,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
PyObject *retValue;
int status;
-#if USE_MAC_MP_MULTITHREADING
- MPEnterCriticalRegion(reentrantLock, kDurationForever);
- PyEval_RestoreThread(_save);
-#endif /* USE_MAC_MP_MULTITHREADING */
-
retValue = PyObject_CallFunction((PyObject *)outPyObject, "O&O&",
EventHandlerCallRef_New, handlerRef,
EventRef_New, event);
@@ -190,11 +168,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
Py_DECREF(retValue);
}
-#if USE_MAC_MP_MULTITHREADING
- _save = PyEval_SaveThread();
- MPExitCriticalRegion(reentrantLock);
-#endif /* USE_MAC_MP_MULTITHREADING */
-
return status;
}
@@ -203,7 +176,6 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
"""
initstuff = initstuff + """
-PyMac_PRECHECK(NewEventHandlerUPP); /* This can fail if CarbonLib is too old */
myEventHandlerUPP = NewEventHandlerUPP(myEventHandler);
"""
module = MacModule('_CarbonEvt', 'CarbonEvents', includestuff, finalstuff, initstuff)
@@ -335,32 +307,6 @@ f = ManualGenerator("GetEventParameter", geteventparameter);
f.docstring = lambda: "(EventParamName eventName, EventParamType eventType) -> (String eventParamData)"
EventRefobject.add(f)
-runappeventloop = """
-#if USE_MAC_MP_MULTITHREADING
-if (MPCreateCriticalRegion(&reentrantLock) != noErr) {
- PySys_WriteStderr("lock failure\\n");
- return NULL;
-}
-_save = PyEval_SaveThread();
-#endif /* USE_MAC_MP_MULTITHREADING */
-
-RunApplicationEventLoop();
-
-#if USE_MAC_MP_MULTITHREADING
-PyEval_RestoreThread(_save);
-
-MPDeleteCriticalRegion(reentrantLock);
-#endif /* USE_MAC_MP_MULTITHREADING */
-
-Py_INCREF(Py_None);
-_res = Py_None;
-return _res;
-"""
-
-f = ManualGenerator("RunApplicationEventLoop", runappeventloop);
-f.docstring = lambda: "() -> ()"
-module.add(f)
-
SetOutputFileName('_CarbonEvtmodule.c')
module.generate()