Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Finding the size of the screen under Multifinder/Color QD Message-ID: <9530@hoptoad.uucp> Date: 7 Jan 90 11:31:10 GMT References: <10139@saturn.ucsc.edu> <9429@hoptoad.uucp> <1102@urbana.mcd.mot.com> <10164@saturn.ucsc.edu> <9490@hoptoad.uucp> <1990Jan5.234652.4485@santra.uucp> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 30 In article <1990Jan5.234652.4485@santra.uucp> jmunkki@kampi.hut.fi (Juri Munkki) writes: >Why would anyone want to access QD globals from a DA/XCMD? The only >global that might be relatively useful is randSeed. To find out the >size of the main screen, call OpenPort to open a dummy grafport. No >need to go peeking at application/QD globals. (Unless you really want >to.) Nope. The OpenPort strategy doesn't work on color systems, at least not in the simple way you seem to be suggesting. If you just look at port.portBits.bounds, you'll be looking at something weird (a handle followed by two integers) on color systems. You can do it (code is below), but using screenBits.bounds is easier. It also consumes much less stack space, less heap space, and less processing overhead in OpenPort and ClosePort. if ((port->portBits.rowBytes & 0x8000) == 0) screen = port->portBits.bounds; else { PixMapHandle pm = ((CGrafPtr) port)->portPixMap; screen = (*pm)->bounds; } -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Now hear a plain fact: Swedenborg has not written one new truth: Now hear another: he has written all the old falshoods. And now hear the reason. He conversed with Angels who are all religious, & conversed not with Devils who all hate religion..." - Blake, "The Marriage of Heaven and Hell"