The 'scrn' Resource
The short description...
The 'scrn' screen resource type describes the setup of graphics devices. Its ID is 0, it's called by InitGraf and created through the control panel. 'scrn' has 14 records--each one describing a single screen device:
The 'scrn' describes a single display. A new 'scrn' is required for each
display in your setup. InitGraf checks your video cards, compares them with the de scriptors in 'scrn', and uses 'scrn' to initialize the monitors--but only
if the spDrvrHw, slot, and dCtlDevBase fields match for ever monitor. If they
don't, 'scrn' doesn't do anything. Moving a card from one slot to another will
invalidate one 'scrn' resource.
typedef struct { Size Offset Description
short ScrnCount 4 0 Total devices
short spDrvrHw 4 4 Slot Manager ID
short slot 4 8 Number of slot
long dCtlDevBase 4 12 Start of device's address space
short mode 4 16 screen characteristics
short flagMask 4 20 Which flag bits are used
short flags 4 24 device state: bit 0 = 0 = mono; bit 0 = 1 = color;
bit 11 = 1 = startup device; bit 15 = 1 = active
short colorTable 4 28 'clut' id, default = -1
short gammaTable 4 32 Selects color intensity, default (MacII) = -1
Rect globalRect 8 40 global rectangle, main device topLeft = 0,0 short ctlCount 4 44 total control calls
short csCode 4 48 control code
short length 4 52 total parameter block bytes
length param block n 56 control call data
}Screen Configuration; 56+n
The longer description...
The user can use the Monitors control panel to set the desired depth of each
screen, whether it displays color or black-and-white, and its position relative
to the main screen. All of this information is stored in a resource of type 'scrn'
in the System File.
Only the 'scrn' resource whose ID is 0 is used by the system. Normally your
application won't have to alter or examine this resource. It's created by the
QuickDraw, it checks the System file for the 'scrn' resource. If the 'scrn'
resource is found and it matches the hardware, InitGraf organizes the screens according to the contents of this resource; if not, then only the startup screen
is used.
The 'scrn' resource consists of a sequence of records, each describing one
screen device. The first word in an 'scrn' resource is the number of devices in
the resource. Following that is information about each screen device. For each
screen device, the resource contains the following fields:
Name Size(in bytes) Description
slot 2 [TOKEN:21356]ot number
dCtlDevBase 4 [TOKEN:25667]tlDevBase from DCE
mode
flagMask 2 [TOKEN:18529]s the value 0x77FE
flags 2 [TOKEN:64512]s device state
bit 0 = 0 if b&w, 1 if color
bit 11 if device is main screen
bit 15 if device is active
colorTable 2 [TOKEN:64257]BID of desired 'clut'
gammaTable 2 [TOKEN:64257]BID of desired 'gama'
globalRect 8 [TOKEN:64512]m's global rectangle
ctlCount 2 [TOKEN:64256]ˆof control calls
For each control call of the screen device, the resource contains the fields:
Name Size [TOKEN:64512]s
csCode 2 [TOKEN:64256]6code for this call
length 2 [TOKEN:64256]ˆof bytes in parameter
block
param blk [ variable] Data to be passed to control call
The records in the 'scrn' resource must be in the same order as the video
cards in the slots (starting with the lowest slot). InitGraf scans through the video cards in the slots and compares them with the de scriptors in the 'scrn'
resource. If the spDrvrHw, slot and dCtlDevBase fields (see above) all match
for every screen device in the system, InitGraf uses the 'scrn' resource to initialize the screens. Otherwise it ignores the 'scrn' resource. Thus if you
move, add, or remove a video card, the 'scrn' resource becomes invalid until the
next time the system starts up.
The spDrvrHw field is a Slot Manager field that identifies the type of hardware on the card. The spDrvrSw field on the card must identify it as an
Apple compatible video driver. The slot field is the number of the slot
containing the card. The dCtlDevBase field is the beginning of the device's
address space, taken from the device's DCE structure.
If all screen devices match, the rest of the information in the 'scrn' resource
is used to configure the screens. The mode field is actually the Slot Manager ID designating the de scriptor for that mode. This same mode number is passed
to the video driver to tell it which mode to use.
The flags bits in the 'scrn' resource determine whether the device is active
(that is, whether it will be used), whether it's color or black-and-white, and
whether it's the main screen. The flagMask field tells which bits in the flags
word are used.
To use the default color table for a device, set the colorTable field to -1. To
use the default gamma table for a device, set the gammaTable field to -1.
(Gamma correction is a technique used to select the appropriate intensities of
the colors sent to a screen device).
The globalRect field specifies the coordinates of the device relative to other
devices. The main device must have the top-left corner of the rectangle set to
(0,0). The coordinates of all otehr devices are specified relative to this device.
Devices may not overlap, and must not share at least part of an edge with
another device.
The union of all active screens (minus the menu bar and the rounded corners
of the outermost screens) is a region that is stored in the global variable
GrayRgn. It defines the area on which windows can be dragged.