Accept Dialogs and Windows where Grafports are expected (such as in SetPort) and do a MacOSX compatible cast. Bit of a hack, but good enough for now.
This commit is contained in:
parent
340eb88fa8
commit
dc2ac8d39f
|
@ -144,8 +144,14 @@ GrafObj_Convert(v, p_itself)
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
GrafPtr *p_itself;
|
GrafPtr *p_itself;
|
||||||
{
|
{
|
||||||
if (DlgObj_Check(v) || WinObj_Check(v)) {
|
if (DlgObj_Check(v)) {
|
||||||
*p_itself = ((GrafPortObject *)v)->ob_itself;
|
DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
|
||||||
|
*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (WinObj_Check(v)) {
|
||||||
|
WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
|
||||||
|
*p_itself = (GrafPtr)GetWindowPort(win);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!GrafObj_Check(v))
|
if (!GrafObj_Check(v))
|
||||||
|
|
|
@ -219,8 +219,14 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
|
||||||
def outputCheckNewArg(self):
|
def outputCheckNewArg(self):
|
||||||
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
|
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
|
||||||
def outputCheckConvertArg(self):
|
def outputCheckConvertArg(self):
|
||||||
OutLbrace("if (DlgObj_Check(v) || WinObj_Check(v))")
|
OutLbrace("if (DlgObj_Check(v))")
|
||||||
Output("*p_itself = ((GrafPortObject *)v)->ob_itself;")
|
Output("DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;")
|
||||||
|
Output("*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));")
|
||||||
|
Output("return 1;")
|
||||||
|
OutRbrace()
|
||||||
|
OutLbrace("if (WinObj_Check(v))")
|
||||||
|
Output("WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;")
|
||||||
|
Output("*p_itself = (GrafPtr)GetWindowPort(win);")
|
||||||
Output("return 1;")
|
Output("return 1;")
|
||||||
OutRbrace()
|
OutRbrace()
|
||||||
def outputGetattrHook(self):
|
def outputGetattrHook(self):
|
||||||
|
|
Loading…
Reference in New Issue