CGDisplayCopyAllDisplayModes leaves out one valid mode

前端 未结 1 1829
甜味超标
甜味超标 2021-02-09 04:41

When programmatically working with display modes in OS X (documentation), I\'ve found that the CGDisplayCopyAllDisplayModes leaves out the rightmost option that is

1条回答
  •  执念已碎
    2021-02-09 05:16

    There's public API that's only documented in the header. CGDisplayCopyAllDisplayModes() takes an options parameter, which is a dictionary. The docs (and even the headers) say that it's unused and you must pass NULL, but you can pass a dictionary with the key kCGDisplayShowDuplicateLowResolutionModes and value kCFBooleanTrue.

    The option name is not really clear. It includes a bunch of extra modes.

    Also, you may need to use CGDisplayModeGetPixelWidth() and CGDisplayModeGetPixelHeight() to distinguish between the point size and the pixel size of the backing store. (CGDisplayModeGetWidth() and CGDisplayModeGetHeight() return point size. By comparing those values, you can determine if the mode is scaled.)

    0 讨论(0)
提交回复
热议问题