[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Monitor Locations
- To: allender@aristotle.ils.nwu.edu, info-mcl@ministry.cambridge.apple.com
- Subject: Re: Monitor Locations
- From: "Mark A. Tapia" <markt@dgp.toronto.edu>
- Date: Mon, 16 Aug 1993 10:24:25 -0400
- Cc: info-mcl@cambridge.apple.com
On Sun Aug 15 15:19:20 1993 Laura Allender writes
Is there a way in MACL (or toolbox calls)
to find out the size of the current monitors
and the appropriate coordinates for the upper left hand corner
of those monitors?
The short answer is to use the #_getdevicelist and #_getnextdevice traps.
Here is code that will do what I think you want for all of the gdevices
on the device list.
mark
(ccl::%require-interface 'quickdraw)
(defun get-gdevice-attributes (screen-gdevice)
;; for a gdevice retrieves the following attributes
;; the underlying port-pixmap, and the two corners of
;; the port-rect
(let ((screen-top (rref screen-gdevice :gdevice.gdrect.topLeft))
(screen-bottom (rref screen-gdevice :gdevice.gdrect.bottomRight))
(port-pmap (rref screen-gdevice :gdevice.gdpmap)))
(values port-pmap ; the screen pixmap
screen-top ; the top left corner of the gdevice port
rect
screen-bottom ; the bottom right corner
)))
(defun get-all-gdevice-attributes ()
;; loop through all of the gdevices on the device list
;; and print the size of the device
(loop with screen-gdevice = (#_getdevicelist) and device-no = 0
until (ccl::%null-ptr-p screen-gdevice)
do (multiple-value-bind (pixmap top bottom)
(get-gdevice-attributes screen-gdevice)
(declare (ignore pixmap))
(format t "~&Device ~d size= ~a [~a -> ~a]~%"
device-no (point-string (subtract-points bottom top))
(point-string top) (point-string bottom)))
do (setq screen-gdevice (#_getnextdevice screen-gdevice))
do (incf device-no)))
? (get-all-gdevice-attributes)
Device 0 size= #@(640 480) [#@(0 0) -> #@(640 480)]
NIL