Page 1 of 1

Question about the display

Posted: Tue Dec 16, 2025 6:32 pm
by rndrei
How can I find out what mode the screen has? (Extended, mirror)

Re: Question about the display

Posted: Tue Dec 16, 2025 8:14 pm
by mk-soft
Over NSScreen: https://developer.apple.com/documentati ... guage=objc

And search forum at "nsscreen"

Re: Question about the display

Posted: Tue Dec 16, 2025 9:38 pm
by TI-994A
There is a built-in function to determine if the display is being mirrored:

Code: Select all

ImportC ""
  CGMainDisplayID()
  CGDisplayIsInMirrorSet(displayId)
EndImport

If Not CGDisplayIsInMirrorSet(CGMainDisplayID())
  mirror$ = "not "
EndIf  

MessageRequester("Mac Main Display", "The screen is " + mirror$ + "being mirrored.")

But I'm not sure how to determine if the display has been extended. :wink:

Re: Question about the display

Posted: Fri Dec 19, 2025 8:24 am
by infratec
Answer form ChatGPT:

Code: Select all

@import CoreGraphics;

BOOL isExtendedDesktop(void) {
    uint32_t count = 0;
    CGGetActiveDisplayList(0, NULL, &count);
    if (count <= 1) return NO;

    CGDirectDisplayID displays[count];
    CGGetActiveDisplayList(count, displays, &count);

    for (uint32_t i = 0; i < count; i++) {
        if (CGDisplayIsInMirrorSet(displays[i])) {
            return NO; // mirroring active
        }
    }
    return YES; // muliple displays, no mirroring => extended
}