summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/qd/qdsupport.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-02-02 22:41:48 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-02-02 22:41:48 (GMT)
commitdc2ac8d39f852bd0925c3462d37046015c79f150 (patch)
tree756461c9c82fadc82618ba9265bc29341ffaee04 /Mac/Modules/qd/qdsupport.py
parent340eb88fa886d81dc3d0153bd96a4690962d91fa (diff)
downloadcpython-dc2ac8d39f852bd0925c3462d37046015c79f150.zip
cpython-dc2ac8d39f852bd0925c3462d37046015c79f150.tar.gz
cpython-dc2ac8d39f852bd0925c3462d37046015c79f150.tar.bz2
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.
Diffstat (limited to 'Mac/Modules/qd/qdsupport.py')
-rw-r--r--Mac/Modules/qd/qdsupport.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index f57cf17..fe606f5 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -219,8 +219,14 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
- OutLbrace("if (DlgObj_Check(v) || WinObj_Check(v))")
- Output("*p_itself = ((GrafPortObject *)v)->ob_itself;")
+ OutLbrace("if (DlgObj_Check(v))")
+ 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;")
OutRbrace()
def outputGetattrHook(self):