RequestVideo.h

/*
    File:       RequestVideo.h
    
    Description:RequestVideo demonstrates the usage of the Display Manager
                introduced  with the PowerMacs and integrated into the system
                under System 7.5. With  the RequestVideo sample code library, 
                developers will be able to explore the Display Manager API by
                changing bit depth and screen resolution on multisync displays
                on built-in, NuBus, and PCI based video. Display Manager 1.0
                is built into the Systems included with the first PowerMacs up
                through System 7.5. Display Manager 2.0 is included with the 
                release of the new PCI based PowerMacs, and will be included
                in post 7.5 System Software releases. 
                    
                It is a good idea to reset the screen(s) to the original setting 
                before exit since the call to RVSetVideoAsScreenPrefs() may not
                do the right thing under Display Manager 1.0 with certain video 
                drivers.
    
                For information on the use of this sample code, please the 
                documentation in the Read Me file
 
 
    Author:     EWA
 
    Copyright:  Copyright: © 1995-1999 by Apple Computer, Inc.
                all rights reserved.
    
    Disclaimer: You may incorporate this sample code into your applications without
                restriction, though the sample code has been provided "AS IS" and the
                responsibility for its operation is 100% yours.  However, what you are
                not permitted to do is to redistribute the source as "DSC Sample Code"
                after having made changes. If you're going to re-distribute the source,
                we require that you make it clear in the source that the code was
                descended from Apple Sample Code, but that you've made changes.
    
    Change History (most recent first):
                6/24/99 Updated for Metrowerks Codewarror Pro 2.1(KG)
                5/31/95 Added RVGetCurrentVideoSetting and RVConfirmVideoRequest routines
                        to make it easy to revert back to where you came from and to give
                        the user a chance to confirm the new setting if the new mode was
                        valid (ie: the card supports it) but not safe (the monitor may not).
                        (EWA)
                5/24/95 Give the kAllValidModesBit requestFlags option for safe only or all
                        valid resolution timings.(EWA)
 
*/
 
#include <QuickDraw.h>
#include <Video.h>
 
// requestFlags bit values in VideoRequestRec (example use: 1<<kAbsoluteRequestBit)
enum {
    kBitDepthPriorityBit        = 0,    // Bit depth setting has priority over resolution
    kAbsoluteRequestBit         = 1,    // Available setting must match request
    kShallowDepthBit            = 2,    // Match bit depth less than or equal to request
    kMaximizeResBit             = 3,    // Match screen resolution greater than or equal to request
    kAllValidModesBit           = 4     // Match display with valid timing modes (may include modes which are not marked as safe)
};
 
// availFlags bit values in VideoRequestRec (example use: 1<<kModeValidNotSafeBit)
enum {
    kModeValidNotSafeBit        = 0     //  Available timing mode is valid but not safe (requires user confirmation of switch)
};
 
// video request structure
struct VideoRequestRec  {
    GDHandle        screenDevice;       // <in/out> nil will force search of best device, otherwise search this device only
    short           reqBitDepth;        // <in>     requested bit depth
    short           availBitDepth;      // <out>    available bit depth
    unsigned long   reqHorizontal;      // <in>     requested horizontal resolution
    unsigned long   reqVertical;        // <in>     requested vertical resolution
    unsigned long   availHorizontal;    // <out>    available horizontal resolution
    unsigned long   availVertical;      // <out>    available vertical resolution
    unsigned long   requestFlags;       // <in>     request flags
    unsigned long   availFlags;         // <out>    available mode flags
    unsigned long   displayMode;        // <out>    mode used to set the screen resolution
    unsigned long   depthMode;          // <out>    mode used to set the depth
    VDSwitchInfoRec switchInfo;         // <out>    DM2.0 uses this rather than displayMode/depthMode combo
};
typedef struct VideoRequestRec VideoRequestRec;
typedef struct VideoRequestRec *VideoRequestRecPtr;
 
// Routine defines
OSErr RVRequestVideoSetting(VideoRequestRecPtr requestRecPtr);
OSErr RVGetCurrentVideoSetting(VideoRequestRecPtr requestRecPtr);
OSErr RVSetVideoRequest (VideoRequestRecPtr requestRecPtr);
OSErr RVConfirmVideoRequest (VideoRequestRecPtr requestRecPtr);
OSErr RVSetVideoAsScreenPrefs (void);