[MacTUG] SafariFullScreen but not "Full Screen"

Dani Roloson daroloso at uwaterloo.ca
Thu May 7 13:59:28 EDT 2015


I had to give up on Swift since passing an array as a parameter is apparently a dark art.
Quartz Display Services has to be used and the closest example was in plain old C
(no bloody ++, Objective, or Objective ++) .

This will give the width and height in pixels for all displays. e.g.
1920 1080
1600 1200
Compiled under 10.10 and runs under 10.8.


//

//  main.c

//

//  clang -framework CoreGraphics -o mydrc main.c

//


#include <stdio.h>

#include <CoreGraphics/CoreGraphics.h>


#define MAX_DISPLAYS 16


int main() {


    CGError dErr;

    CGDisplayCount displaycount, i;

    CGDisplayCount maxDisplays = MAX_DISPLAYS;

    CGDirectDisplayID onlineDisplays[MAX_DISPLAYS];


    dErr = CGGetOnlineDisplayList(maxDisplays, onlineDisplays, &displaycount);

    if (dErr != kCGErrorSuccess) {

        fprintf(stderr, "CGGetOnlineDisplayList: error %d.\n", dErr);

        exit(1);

    }

    for(i = 0; i < displaycount; i++) {

        CGDirectDisplayID dID = onlineDisplays[i];

        printf("%lu %lu\n", CGDisplayPixelsWide(dID), CGDisplayPixelsHigh(dID));


    }

    return 0;

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uwaterloo.ca/pipermail/mactug/attachments/20150507/cc3a050e/attachment.html>


More information about the MacTUG mailing list