Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Macmodule and macosmodule have also been carbonified. Some functionality is still missing there.
diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c
index fbbadd8..15f61f5 100644
--- a/Mac/Modules/dlg/Dlgmodule.c
+++ b/Mac/Modules/dlg/Dlgmodule.c
@@ -154,7 +154,7 @@
it = PyObject_NEW(DialogObject, &Dialog_Type);
if (it == NULL) return NULL;
it->ob_itself = itself;
- SetWRefCon(itself, (long)it);
+ SetWRefCon(GetDialogWindow(itself), (long)it);
return (PyObject *)it;
}
DlgObj_Convert(v, p_itself)
@@ -692,12 +692,12 @@
PyObject *_args;
{
PyObject *_res = NULL;
- DialogPtr _rv;
+ WindowPtr _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetDialogWindow(_self->ob_itself);
_res = Py_BuildValue("O&",
- WinObj_WhichWindow, _rv);
+ WinObj_New, _rv);
return _res;
}
@@ -743,6 +743,8 @@
return _res;
}
+#ifndef TARGET_API_MAC_CARBON
+
static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args)
DialogObject *_self;
PyObject *_args;
@@ -755,6 +757,7 @@
_res = Py_None;
return _res;
}
+#endif
static PyMethodDef DlgObj_methods[] = {
{"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
@@ -814,15 +817,18 @@
{"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1,
"() -> (EventMask outMask)"},
{"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
- "() -> (DialogPtr _rv)"},
+ "() -> (WindowPtr _rv)"},
{"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
"() -> (SInt16 _rv)"},
{"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
"() -> (SInt16 _rv)"},
{"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
"() -> (SInt16 _rv)"},
+
+#ifndef TARGET_API_MAC_CARBON
{"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1,
"() -> None"},
+#endif
{NULL, NULL, 0}
};