[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: optional monitors
- To: Yuri A. Tijerino <yuri@ei.sanken.osaka-u.ac.jp>
- Subject: Re: optional monitors
- From: Bill St. Clair <bill>
- Date: Wed, 20 Mar 91 11:27:41 -0500
- Cc: info-macl@cambridge.apple.com
- In-reply-to: Your message of Wed, 20 Mar 91 16:33:39 +0900. <9103200733.AA00865@sp7.ei.sanken.osaka-u.ac.jp>
Date: Wed, 20 Mar 91 16:33:39 +0900
From: Yuri A. Tijerino <yuri@ei.sanken.osaka-u.ac.jp>
To: info-macl@cambridge.apple.com
Subject: optional monitors
Hi, there.
Is there any function that checks whether there are any optional
monitors installed and one that returns the size and coordinates of
that monitor if it exists?
Yuri Adrian Tijerino (Ph.D student)
Osaka University
email: yuri@ei.sanken.osaka-u.ac.jp
The following is an excerpt from the MCL 2.0 code that finds the best
color screen on which to display the color picker window. I haven't
tested it in 1.3, but it should work with only a few changes.
DO-SCREENS and SCREEN-POSITION will be relevant for what you want to
do.
---------------------------------------------------------------------------
(require 'traps)
; GDevice attributes
(defconstant $gdDevType 0) ; 0 = mono, 1 = color
(defconstant $ramInit 10) ; set if device has been initialized from RAM
(defconstant $mainScreen 11) ; set if device is the main screen
(defconstant $allInit 12) ; set if devices were inited from a 'scrn' resource
(defconstant $screenDevice 13) ; set if device is a screen device
(defconstant $noDriver 14) ; set if device has no driver
(defconstant $screenActive 15) ; set if device is active
(defrecord (gDevice :handle)
(gdRefNum :integer)
(gdID :integer)
(gdType :integer)
(gdITable :handle) ; really ITabHandle
(gdResPref :integer)
(gdSearchProc :handle) ; really SProcHndl
(gdCompProc :handle) ; really CProcHndl
(gdFlags :integer)
(gdPMap (:handle PixMap))
(gdRefCon :longint)
(gdNextGD (:handle gDevice))
(gdRect :rect)
(gdMode :longint)
(gdCCButes :integer)
(gfCCDepth :integer)
(gdCCXData :handle)
(gdCCXMask :handle)
(gdReserved :longint))
(defun screen-attribute (screen attribute)
(_TestDeviceAttribute :ptr screen :word attribute :boolean))
(defun screen-active-p (screen)
(and (screen-attribute screen $screenDevice)
(screen-attribute screen $screenActive)))
(defun screen-color-p (screen)
(screen-attribute screen $gdDevType))
(defun screen-bits (screen)
(rref (rref screen :GDevice.gdPMap) :PixMap.PixelSize))
(defun screen-position (screen)
(rref screen :GDevice.gdRect.topleft))
(defun screen-size (screen)
(subtract-points
(rref screen :GDevice.gdRect.bottomright)
(screen-position screen)))
(defmacro do-screens ((s &optional (active-only? t)) &body body)
`(let ((,s (_GetDeviceList :ptr)))
(until (null ,s)
(when ,(if active-only? `(screen-active-p ,s) t)
,@body)
(setq ,s (_GetNextDevice :ptr ,s :ptr)))))
(unless (assoc 'do-screens *fred-special-indent-alist*)
(push '(do-screens . 1) *fred-special-indent-alist*))