Contents

CGConfigureDisplayMirrorOfDisplay(_:_:_:)

Changes the configuration of a mirroring set.

Declaration

func CGConfigureDisplayMirrorOfDisplay(_ config: CGDisplayConfigRef?, _ display: CGDirectDisplayID, _ master: CGDirectDisplayID) -> CGError

Parameters

  • config:

    A display configuration, acquired by calling Cgbegindisplayconfiguration(_:).

  • display:

    The identifier of the display to add to a mirroring set.

  • master:

    A display in a mirroring set, or kCGNullDirectDisplay to disable mirroring. To specify the main display, use Cgmaindisplayid().

Return Value

A result code. See Core Graphics Data Types and Constants.

Discussion

Display mirroring and display matte generation are implemented either in hardware (preferred) or software, at the discretion of the device driver.

  • Hardware mirroring

With hardware mirroring enabled, all drawing is directed to the primary display—see CGDisplayPrimaryDisplay(_:).

If the device driver selects hardware matte generation, the display bounds and row-bytes values are adjusted to reflect the active drawable area.

  • Software mirroring

In this form of mirroring, identical content is drawn into each display in the mirroring set. Applications that use the window system need not be concerned about mirroring, as the window system takes care of all flushing of window content to the appropriate displays.

Applications that draw directly to the display, as with display capture, must make sure to draw the same content to all mirrored displays in a software mirror set. When drawing to software mirrored displays using a full screen OpenGL context (not drawing through a window), you should create shared OpenGL contexts for each display and rerender for each display.

You can use the function CGGetActiveDisplayList(_:_:_:) to determine which displays are active, or drawable. This automatically gives your application the correct view of the current displays.

See Also

Functions