jakehilborn / displayplacer

macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.
MIT License
3.74k stars 134 forks source link

Updated display mode struct #112

Open andrews05 opened 1 year ago

andrews05 commented 1 year ago

Just FYI, I've put together a more detailed version of the private struct for display mode descriptions.

typedef struct CGSDisplayModeDescription {
    uint32_t ioDisplayModeID_alt;   // Should be the same as ioDisplayMode
    uint32_t ioFlags_alt;           // Mostly the same but slightly different to ioFlags
    uint32_t width;
    uint32_t height;
    uint32_t maxDepthIndex;
    uint32_t bytesPerRow;
    uint32_t bitsPerPixel;
    uint32_t bitsPerSample;
    uint32_t samplesPerPixel;
    uint32_t refreshRate;
    uint32_t unknown[2];
    char pixelEncoding[64];
    uint32_t unknown2[19];
    uint32_t refreshRate_fixed;     // 16.16 fixed fraction
    uint32_t ioFlags;
    uint32_t ioDisplayModeID;
    uint32_t pixelWidth;
    uint32_t pixelHeight;
    float backingScaleFactor;
} CGSDisplayModeDescription;

The following documents were helpful references for this: https://developer.apple.com/documentation/coregraphics/cgdisplaymode https://developer.apple.com/documentation/coregraphics/quartz_display_services/display_mode_standard_properties https://github.com/aosm/IOGraphics/blob/ae89a5073a37ffd77cfb964921e05fc90810dbb8/IOGraphicsFamily/IOKit/graphics/IOGraphicsTypes.h#L128